简体   繁体   中英

No Such Module 'FBSDKLoginKit' Xcode 9

Using CocoaPods, I have imported the below frameworks:

platform :ios, '11.0'
use frameworks!

target '{APP NAME}' do
    pod 'Firebase'
    pod 'Firebase/Auth'
    pod 'Firebase/Core'
    pod 'Firebase/Database'
    pod 'Firebase/AdMob'
    pod 'Firebase/Messaging'
    pod 'Batch'
    pod 'FBSDKLoginKit'
    pod 'FBSDKCoreKit'
    pod 'Google-Mobile-Ads-SDK'
end

在此处输入图片说明

When I build my project, it runs happily on my iPhone with no errors.

When I try to create an Archive of the project, it shows one of the below and refuses to build the project to Archive.

No such module 'FBSDKCoreKit'
No such module 'FBSDKLoginKit'

在此处输入图片说明 在此处输入图片说明

I have no idea what I'm doing wrong as nothing has changed. I haven't archived in a few months and it's suddenly stopped working.

I've removed and re-installed the Pods but nothing seems to fix the issue. Even if I remove one of the import statements the other FBSKD seems to fail.

Try this!

pod 'FBSDKCoreKit', '~> 4.10.0'
pod 'FBSDKLoginKit', '~> 4.10.0'
pod 'FBSDKShareKit', '~> 4.10.0'

Please add

pod 'FBSDKCoreKit'

also.

Try to update your pod file like this

 pod 'FacebookCore'
 pod 'FacebookLogin'

Not sure if you already found an answer but this worked for me, I had the same problem as you, kind of weird but it worked.

I uninstalled the pods 'FBSDKCoreKit', 'FBSDKShareKit', and 'FBSDKLoginKit'

I then installed pods 'FacebookCore' and 'FacebookLogin' this also installs the previous pods I uninstalled.

When I typed import FBSDKCoreKit in my AppDelegate header I still received an error.

So just for shits and gigs I removed import FBSDKCoreKit and replaced it with import FacebookLogin and there were no errors

I then typed in the necessary code in my AppDelegate file stated in the instructions of Step 5: Connect to AppDelegate ( https://developers.facebook.com/docs/ios/getting-started )

I ran the app, the build failed but I went into my AppDelegate file and again, for shits and gigs, typed in import FBSDKCoreKit in the header (without removing import FacebookCore) and there were no errors. Then I removed import FacebookCore from the header and still no errors.

still messing with the syntax to get "Build Successful" but it seems to be heading in the right direction.

I'm new to xCode and Swift, so honestly I'm not exactly sure what I did that was the main reason for the fix but this worked for me. Let me know if this helped!

The actual issue is there is a bug with Xcode wherein it's not recognizing the pods already installed and added to the project. That's why the module not found error during compile time. I am getting the same build error with many other pods afterwards also. It's happening only at times that too unexpectedly. The only way is to build the project multiple times until it recognizes the module and the error is gone. This sounds crazy but no other way so far. Also, Use cmd+B to build your code.

This error appeared for me when I added a new build-target to my project.
Xcode added this change which caused all the trouble.

-               E31B6D4E3385CBFF63FDF655 /* BuildFile in Frameworks */,
 +              E31B6D4E3385CBFF63FDF655 /* (null) in Frameworks */,

When I removed the change from my commit history, all worked fine.
I did so with an interactive rebase.

Try this!!

Goto General -> Linked Frameworks and Libraries -> remove Framework.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM