Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import a Cocoapod into an App Extension?

enter image description hereUsing Pinterest's iOS SDK via Cocoapods and a bridging header, works fine in my app.

Created new target -> action extension in my project. Have tried linking PDK framework in Linked Frameworks and Libraries, have tried adding a separate bridging header file in the extension, but Xcode crashes not being able to find it.... Any ideas on how to import it?

podfile:

platform :ios, '9.0'

pod "PinterestSDK", :git => "[email protected]:pinterest/ios-pdk.git"

pod "PINRemoteImage"

pod "GBDeviceInfo"

pod 'FBSDKCoreKit'



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

bridging header:

#import "PinterestSDK.h"
#import "PDKPin.h"
#import "PDKBoard.h"
#import "PDKImageInfo.h"
#import "PDKResponseObject.h"
#import "PDKClient.h"
#import "PDKModelObject.h"
#import "PDKUser.h"
like image 303
GarySabo Avatar asked Mar 19 '17 04:03

GarySabo


People also ask

How do I open a Podfile file?

If you cannot open your POD file correctly, try to right-click or long-press the file. Then click "Open with" and choose an application. You can also display a POD file directly in the browser: Just drag the file onto this browser window and drop it.


1 Answers

Check this pod file code as example, this pod file have 2 targets the app and the extension.

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

I hope this helps you, best regards

like image 53
Reinier Melian Avatar answered Oct 23 '22 04:10

Reinier Melian