如何将Cocoapod导入App扩展?

时间:2017-03-19 04:06:41

标签: ios swift frameworks cocoapods

enter image description here通过Cocoapods和桥接头使用Pinterest的iOS SDK,在我的应用中运行良好。

创建新目标 - >我的项目中的动作扩展。尝试在链接框架和库中链接PDK框架,尝试在扩展中添加单独的桥接头文件,但Xcode崩溃无法找到它....有关如何导入它的任何想法?

podfile:

platform :ios, '9.0'

pod "PinterestSDK", :git => "git@github.com:pinterest/ios-pdk.git"

pod "PINRemoteImage"

pod "GBDeviceInfo"

pod 'FBSDKCoreKit'



xcodeproj '/Users/garysabo/Dropbox/Xcode Projects/pinFixer2/pinFixer2.xcodeproj'

桥接标题:

#import "PinterestSDK.h"
#import "PDKPin.h"
#import "PDKBoard.h"
#import "PDKImageInfo.h"
#import "PDKResponseObject.h"
#import "PDKClient.h"
#import "PDKModelObject.h"
#import "PDKUser.h"

1 个答案:

答案 0 :(得分:2)

以此pod文件代码为例,此pod文件有2个目标应用和扩展名。

platform :ios, '9.0'
use_frameworks!
workspace 'MyWorkSpaceApp'

target 'MyApp' do

       pod 'SwiftyUserDefaults'
       pod 'Alamofire', '~> 4.0'
       pod 'AlamofireImage', '~> 3.1'
       #pod 'AlamofireNetworkActivityIndicator', '~> 2.0'
       #pod "youtube-ios-player-helper", "~> 0.1.6"
       #pod 'Alamofire-SwiftyJSON'
       pod 'SwiftyJSON', '~> 3.0.0'
       #pod 'SlideMenuControllerSwift'
       pod 'UIColor_Hex_Swift', '~> 3.0.2'
       #pod 'ALLoadingView', :git => 'https://github.com/ALoginov/ALLoadingView.git', :branch => 'swift3'
       pod 'SDWebImage', '~>3.8'
       #pod 'SwiftSpinner', :git => 'https://github.com/icanzilb/SwiftSpinner.git', :branch => 'swift3'
       #pod 'SideMenu'
       #pod 'Fabric'
       #pod 'Crashlytics'
       #pod 'IQKeyboardManagerSwift', '4.0.6'
       #pod 'AELog'
       #pod 'TestFairy'
       #pod "AwesomeCache", "~> 5.0"
       #pod 'Deviice'
       #pod 'MKDropdownMenu'
       #pod "HanekeSwift", :git => 'https://github.com/Haneke/HanekeSwift.git', :branch => 'feature/swift-3'
       pod 'OneSignal', '~> 2.4'

       post_install do |installer|
        puts("Update debug pod settings to speed up build time")
        Dir.glob(File.join("Pods", "**", "Pods*{debug,Private}.xcconfig")).each do |file|
            File.open(file, 'a') { |f| f.puts "\nDEBUG_INFORMATION_FORMAT = dwarf" }
        end
    end

       target 'MyAppExtension' do 
           pod 'OneSignal', '~> 2.4'
       end

end

我希望这能帮到你,最好的问候