Facebook SDK 导致 React Native 构建失败

Facebook SDK causes React Native build to fail

我的团队正在使用 React Native 构建我们的第一个 iOS 应用程序。出于某种原因,仅在我的 Mac 上,构建在 运行 react-native run-ios 之后失败。自从我们使用 react-native-fbsdk.

添加 Facebook 身份验证以来,这种情况一直在发生

我们都是运行node -v 7.0和Xcode的最新版本。我什至尝试在本地删除回购协议并将其克隆回来。作为一项实验,我团队的另一名成员在本地删除了他的回购协议,将其克隆回来,并且能够让一切正常运行。我们坐在一起,做了完全相同的步骤,这对他有效,但对我无效。

以下是我在终端中收到的错误消息:

** BUILD FAILED **


The following build commands failed:
CompileC /Users/philmok/js_projects/pLot/ios/build/Build/Intermediates/RCTFBSDK.build/Debug-iphonesimulator/RCTFBSDK.build/Objects-normal/x86_64/RCTFBSDKGraphRequestManager.o RCTFBSDK/core/RCTFBSDKGraphRequestManager.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Installing build/Build/Products/Debug-iphonesimulator/pLot.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist

Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/pLot.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist

根据 this question 上的回答,我已尝试 运行 react-native upgrade。这将允许构建完成,但会阻止 Facebook 身份验证工作。

您完成所有配置步骤了吗?这里有很棒的介绍,一步一步介绍如何添加 facebook sdk 以响应本机应用程序:https://github.com/magus/react-native-facebook-login。顺便提一句。如果可以的话,我建议使用这个库,我在使用官方 facebook sdk 时遇到了很多问题,移到了那个,一切正常。

确保您已经下载了用于fb 登录的FBSDK。将它放在您的文档文件夹中,然后在 xcode 中打开您的项目。单击左侧菜单中的项目和 select 构建设置选项卡,在文档中为 'framework path' 提供 FBSDK 的路径。

添加

  pod 'FBSDKCoreKit'
  pod 'FBSDKLoginKit'
  pod 'FBSDKShareKit'

到您的 Podfile 然后 pod install