I\'ve installed FBSDK with Cocoapods but can\'t import it in my AppDelegate.swift file for some reason. The FBSDK kit appears in my Xcode project so I feel like it should be wor
Are you opening the .xcodeproj
or the .xcworkspace
? Make sure it is the workspace whenever you install a cocoapod
First Clean your project directory. And add $(inherited) in framework search path in Build settings.
Start by cleaning your project using Command + Shift + K
then close the project and delete the pods
folder and the pod.lock
file and your .xcworkspace
file. Then run pod install
and see if that fixes the issue.
In my case, it was correctly installed but I realized the pod is Objective-C and couldn't import it on a Swift file. I had to create a bridging header to make it work.
Refer to this stackoverflow thread How to import existing Objective C classes in Swift
Why not simply use the Swift pods?-
pod 'FacebookCore'
pod 'FacebookLogin'
pod 'FacebookShare'
and then import as normal, like-
import FBSDKLoginKit
import FacebookLogin
Once done, do a clean and build (command/⌘ + Shift + K) and Build (command/⌘ + B). Make sure you are using the .xcworkspace
file to open the project.
More info on Swift FBSDK here.
Once you use the Swift pods, you should see these Frameworks in your project.
If you still continue to see the error then "Clean the build folder" using command + shift + alt + K.