No Such Module 'FBSDKLoginKit' Xcode 9

2019-05-25 20:38发布

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

enter image description here

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'

enter image description here enter image description here

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.

7条回答
Root(大扎)
2楼-- · 2019-05-25 21:21

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.

查看更多
【Aperson】
3楼-- · 2019-05-25 21:27

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!

查看更多
We Are One
4楼-- · 2019-05-25 21:33

Try this!

pod 'FBSDKCoreKit', '~> 4.10.0'
pod 'FBSDKLoginKit', '~> 4.10.0'
pod 'FBSDKShareKit', '~> 4.10.0'
查看更多
闹够了就滚
5楼-- · 2019-05-25 21:38

Please add

pod 'FBSDKCoreKit'

also.

查看更多
We Are One
6楼-- · 2019-05-25 21:39

The actual issue is there is a bug with Xcode wherein its not recognizing the pods already installed and added to the project.Thats why the module not found error during compile time. I am getting the same build error with many other pods afterwards also.Its 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. Hope this helps.

查看更多
聊天终结者
7楼-- · 2019-05-25 21:40

Try this!!

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

查看更多
登录 后发表回答