如何将 Cocoapod 导入 App Extension?

How to import a Cocoapod into an App Extension?

通过 Cocoapods 和桥接头使用 Pinterest 的 iOS SDK,在我的应用程序中运行良好。

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

播客文件:

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"

以这个 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

希望对您有所帮助,祝好