Search code examples
swiftxcodecocoapodsfacebook-loginfacebook-sdk-4.x

No such module 'FacebookCore' in swift 5


I am doing my own test app as part of my learning process in iOS development (using swift 5 on Xcode 11.0). I want to add login with Facebook on my login page but I keep getting No such module 'FacebookCore' when importing the library.

enter image description here

I followed the instructions on developer.facebook and tried to implement the SDK using cocoaPods and here is my Podfile

 # Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'TestApp' do

  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for TestApp
  pod 'FBSDKCoreKit'
  pod 'FBSDKLoginKit'

  target 'TestAppTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'TestAppUITests' do
    # Pods for testing
  end

end

After executing pod install and adding the data in my info.plist as instructed by Facebook, I can clearly see that the framework has been linked in the Link Binary With Libraries section

enter image description here

But still, I can't seem to import FacebookCore nor FacebookLogin.

PS: I tried several solutions like:

1- Running the .xcworkspace instead of .xcodeproj

2- Building the project even with the error being displayed (some said it would go away)

But none of them worked.

I suspect that the problem is in my Framework search path but why would it be wrong in the first place? so I may be wrong, here's a screenshot to my search path anyway:

enter image description here


Solution

  • So it turned out that I have to import FBSDKCoreKit instead of FacebookCore which was not mentioned in facebook's documentation. And it should be imported strictly using the .xcworkspace file which was also not mentioned in the documentation.