Can't import dependency installed with Cocoapods

后端 未结 11 1134
醉梦人生
醉梦人生 2021-02-07 11:16

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

11条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-07 12:07

    As importing the FBSDKCoreKit.framework etc. will be performed in the [CP] Embed Pods Frameworks build phase when using CocoaPods, you should remove the references to these frameworks in the Embed Frameworks build phase.

    CocoaPods will not create those references, I assume you have tried other ways of importing the Facebooks frameworks, and these link have been created in the process. You can also delete the references to the Facebook frameworks in the Frameworks Folder of you App-Project (the ones in your screenshot written in red, not the ones in the Pods-Project!), but keep the Pods_Runner.framework there.

    From what I can tell, your Linked Frameworks and Libraries section looks valid.

    If it still doesn't work, I'd advise you to create a new Xcode Project with an empty Podfile, and only include the Facebook frameworks via CocoaPods. Importing the Facebook-SDK in the AppDelegate should work then, otherwise I can share a sample project with you. Then you should check your build setting and build phases, maybe something is wrong there. If you still can't figure out the problem, you will probably need to re-create you xcode-project and import all your files again.

    Without a sample Project that reproduces the error, that's the best advise I can give.

    Good Luck! :)

提交回复
热议问题