Reputation: 181
I'm trying to integrate facebook into my app using CocoaPods, using the use_frameworks! tag, and according to facebook's instructions here, also included the pod bolts. When I try use import FBSDKCoreKit
in my appdelegate, I get a no such module 'FBSDKCoreKit error. I've included my podfile below:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.2'
use_frameworks!
pod 'Bolts'
pod 'Alamofire', '~> 3.0'
pod 'FBSDKCoreKit'
pod 'FBSDKShareKit'
pod 'FBSDKLoginKit'
Additionally, in my Pods folder, there is a question mark next to Bolts, FBSDKCoreKit, and FBSDKSharekit, but not one next to alamofire, which I had been using previously. In the Frameworks folder in my Pods project, FBSDKCoreKit and Bolts are listed there, but are both red. Any ideas? I've tried cleaning my project, and reinstalling and updating the pods.
Upvotes: 7
Views: 12735
Reputation: 2990
Very simple solution, if you are using Apple Swift Packages
:
Go to Navigator pane and select the project
Then make sure you choose project name under "Project" not under "Targets"
Then select Package Dependencies tab
You will find the Facebook package there, double click on it
Change version to 9.0.0 and click "Done"
Rebuild, and it should be corrected.
Note that you may need this url to add Facebook SDK as Apple Swift Packages
rather than Cocoapods.
Upvotes: 0
Reputation: 40156
Please try below steps,
pod 'FBSDKCoreKit', '~>5.8.0'
pod 'FBSDKShareKit', '~>5.8.0'
pod 'FBSDKLoginKit', '~>5.8.0'
sudo pod repo update
pod update
Upvotes: 1
Reputation: 4042
For people moving from Carthage
to Cocoapods
make sure to remove the Carthage references of the FBSDKCoreKit
from the Link Binary With Libraries
under Build Phases
option.
Upvotes: 2
Reputation: 79
first add in pod file
pod 'FacebookCore'
pod 'FacebookLogin'
pod 'FacebookShare'
this is facebook swift library,after that before using FBSDKCoreKit,just use FacebookCore then import FBSDKCoreKit
Upvotes: -2
Reputation: 181
I fixed this by
Upvotes: 0
Reputation: 3494
Seems that the facebook pods are Objective-C and they need a special way of importing in a swift project.
This is how I got it to work:
Create a bridging header in your project, if you dont have one(I created a new header file called Bridging-Header.h
and set it as a bridging header in the project settings, like in the screenshot)
Then in this file import the facebook modules. Here's how my file looks like:
#ifndef Bridging_Header_h
#define Bridging_Header_h
@import FBSDKCoreKit;
@import FBSDKLoginKit;
#endif /* Bridging_Header_h */
Let me know if this workout for you or you need more help.
Upvotes: 0