简体   繁体   English

在swift iOS应用程序中使用FBSDK的问题

[英]issue using FBSDK in swift iOS application

I am coding an iOS 8 app in swift using the FBSDK to allow users to log in to my app. 我正在使用FBSDK在swift中编写iOS 8应用程序,以允许用户登录我的应用程序。 So far I have successfully implemented the login feature using the FBSDK v3.25 in swift using a Bridging-Header.h file and updating the info.plist accordingly to the instructions given on the FB developers website. 到目前为止,我已经使用Briftging-Header.h文件在swift中使用FBSDK v3.25成功实现了登录功能,并根据FB开发人员网站上给出的说明更新了info.plist。 Now I want to make an app (or update my current one) to FBSDK v4.01 but when I follow the same process of integrating it into my app I get the following errors: 现在我想创建一个应用程序(或更新我当前的应用程序)到FBSDK v4.01但是当我按照将它集成到我的应用程序的相同过程时,我得到以下错误:

-> FBSDKAppLinkResolver.h

    /Users/danieloram/Desktop/IOS/SWIFT/FBLoginUsingSDK4/FacebookSDK/FBSDKCoreKit.framework/Headers/FBSDKAppLinkResolver.h:21:9: Include of non-modular header inside framework module 'FBSDKCoreKit.FBSDKAppLinkResolver'

    /Users/danieloram/Desktop/IOS/SWIFT/FBLoginUsingSDK4/FacebookSDK/FBSDKCoreKit.framework/Headers/FBSDKAppLinkResolver.h:21:9: Include of non-modular header inside framework module 'FBSDKCoreKit.FBSDKAppLinkResolver'

-> Bridging-Header.h

    /Users/danieloram/Desktop/IOS/SWIFT/FBLoginUsingSDK4/FBLoginUsingSDK4/Bridging-Header.h:12:9: Could not build module 'FBSDKCoreKit'

    /Users/danieloram/Desktop/IOS/SWIFT/FBLoginUsingSDK4/FBLoginUsingSDK4/Bridging-Header.h:13:9: Could not build module 'FBSDKLoginKit'

    /Users/danieloram/Desktop/IOS/SWIFT/FBLoginUsingSDK4/FBLoginUsingSDK4/Bridging-Header.h:12:9: Could not build module 'FBSDKCoreKit'

->FBSDKLoginButton.h

    /Users/danieloram/Desktop/IOS/SWIFT/FBLoginUsingSDK4/FacebookSDK/FBSDKLoginKit.framework/Headers/FBSDKLoginButton.h:21:9: Could not build module 'FBSDKCoreKit'

    Failed to import bridging header '/Users/danieloram/Desktop/IOS/SWIFT/FBLoginUsingSDK4/FBLoginUsingSDK4/Bridging-Header.h'

The most obvious thing to note is the last error which says the bridging header cannot be found but it is in the same place as it was for when I was using FBSDK 3.25? 最值得注意的是最后一个错误,它表示无法找到桥接头,但它与我使用FBSDK 3.25时的位置相同?

Also, all of the documentation and tutorials on the FaceBook developers website are all in obj-c so finding a solution has been a very frustrating process. 此外,FaceBook开发人员网站上的所有文档和教程都是obj-c,因此找到解决方案是一个非常令人沮丧的过程。 Can anyone help diagnose what i am doing wrong? 谁能帮助诊断我做错了什么? Any help is appreciated! 任何帮助表示赞赏!

update 更新

for the time being I have managed to compile my app by following the instructions in the Facebook developers portal and removing all modules from the FBSDK by running the following in terminal 目前我已经设法按照Facebook开发人员门户网站上的说明编译我的应用程序,并通过在终端中运行以下命令从FBSDK中删除所有模块

rm -r ~/Documents/FacebookSDK/FBSDKCoreKit.framework/Modules/
rm -r ~/Documents/FacebookSDK/FBSDKLoginKit.framework/Modules/
rm -r ~/Documents/FacebookSDK/FBSDKShareKit.framework/Modules/

this is my workaround until a proper fix is released. 这是我的解决方法,直到发布适当的修复程序。

This is a bug and Facebook is currently "assigning this to the appropriate team". 这是一个错误,Facebook目前正在“将此分配给相应的团队”。

To get updates to this issue follow this link: 要获取此问题的更新,请访问以下链接:

https://developers.facebook.com/bugs/362995353893156/ https://developers.facebook.com/bugs/362995353893156/

and hit subscribe. 并点击订阅。

Some people have found success using the answers on this link (none have worked for me): 有些人使用此链接上的答案找到了成功(没有一个对我有用):

Facebook iOS8 SDK build module error for FBSDKCoreKit FBSDKCoreKit的Facebook iOS8 SDK构建模块错误

For those of you trying to compile a swift project with FB cocoaPods. 对于那些试图用FB cocoaPods编译swift项目的人。

*BTW, it worked once, only in xCode 7.1 it stopped * BTW,它工作过一次,只在xCode 7.1中停止了

Only after playing with everything, I did 2 things: 只有在玩完一切之后,我做了两件事:

  1. Added the following code at the end of the pod: 在pod的末尾添加了以下代码:

     post_install do |installer| installer.pods_project.build_configuration_list.build_configurations.each do |configuration| configuration.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES' end 

    end 结束

  2. Remove the 'new and improved' swift imports, and add FB into the obj-C bridging header: A small screenshot of my bridging header 删除'新的和改进的'swift导入,并将FB添加到obj-C桥接标题中: 我的桥接标题的小屏幕截图

Try with build settings. 尝试使用构建设置。 Set Allow Non-modular Includes in Framework modules to YES . Allow Non-modular Includes in Framework modules设置为YES

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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