Facebook SDK导致React Native构建失败

4

我的团队正在使用React Native构建我们的第一个iOS应用程序。但是仅在我的Mac上,运行react-native run-ios后构建会失败,这种情况发生在我们添加了react-native-fbsdk进行Facebook身份验证之后。

我们所有人都在运行node -v 7.0和最新版本的Xcode。我甚至尝试过删除本地repo并将其克隆回来。作为一次实验,我的团队的另一名成员删除了他的本地repo,将其克隆回来,并成功地让一切正常。我们坐在一起,做了完全相同的步骤,但对他有效而对我无效。

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

** 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

根据这个问题上的答案,我尝试运行react-native upgrade。这将允许构建完成,但会导致Facebook身份验证无法工作。

3个回答

5

请确保您已经下载了用于Facebook登录的FBSDK。将其放置在您的文档文件夹中,然后在Xcode中打开您的项目。点击左侧菜单中的项目,选择“构建设置”选项卡,在“框架路径”中给出您在文档中的FBSDK路径。


在安卓中你应该做什么? - Shariq Musharaf
@ShariqMusharaf 不确定,这是针对iOS的特定情况。我没有尝试过在Android上运行。 - Zach Raymer

2

添加

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

将以下代码添加到您的 Podfile,然后运行 pod install

1

你是否完成了所有的配置步骤?这里有一个很好的介绍,逐步说明如何将Facebook SDK添加到React Native应用程序中:https://github.com/magus/react-native-facebook-login。顺便说一句,如果可以的话,我建议使用这个库,因为我在使用官方的Facebook SDK时遇到了很多问题,转而使用了这个库,一切都正常了。


我的团队成员已经在使用官方的React Native fbsdk,并且对他们所有人都有效。更换另一个库不是一个选择。 - Phil Mok
你试过从 xCode 运行应用程序吗?有时你需要手动设置 BundleIdentifier(在 xCode -> General -> Bundle Indentifier 中将其设置为类似于 com.myproject 的内容)。 - jonzee
是的,捆绑标识符已经设置。 - Phil Mok

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接