1

我已经正确安装了 facebook SDK。(这与其他未找到的错误不同,因为它专门针对 react-native-fbsdk 并且没有任何解决方案有效。)

FBSDKCoreKit我已经通过将标头和FBSDKShareKit标头都导入到其中来测试我安装了 SDK,AppDelegate.m并且它编译并运行没有问题。

但是,当我安装 react-native-fbsdk 并链接它并编译时,我得到了“找不到 FBSDKCoreKit/FBSDKCoreKit.h”的错误。与FBSDKShareKit.

github 页面上的故障排除提供了 3 个选项来检查何时发生这种情况:

  1. 确保 Facebook SDK 框架安装在 ~/Documents/FacebookSDK 中。

  2. 确保FBSDK[Core, Login, Share]Kit.framework显示在构建目标的构建阶段的链接二进制与库部分中。

  3. 确保 ~/Documents/FacebookSDK 位于构建目标的构建设置的框架搜索路径中。

我已经检查并确认我拥有所有这些,但没有找到解决方案。奇怪的是,我可以将它们导入,AppDelegate.m而且效果很好。

4

3 回答 3

2

您需要确保将 SDK 框架保存在文件夹~/Documents/FacebookSDK下

因为 react-native-fbsdk iOS 项目在其自己的框架搜索路径定义中硬编码了值“~/Documents/FacebookSDK”

于 2017-03-09T19:17:59.420 回答
1

If you are like me and don't want to do what Facebook tells you (or you don't want to put random stuff on your Documents folder):

  1. Replace every instance of ~/Documents/FacebookSDK in the QuickStart tutorial with the place you do want to store the SDK, in my case ~/Library/FacebookSDK. That means, unzip the downloaded SDK there and add that route to your project's Framework Search Paths. *
  2. In Xcode's file tree, expand the Libraries group and click on RCTFBSDK.xcodeproj. On that project click Build Settings and add your route to its Framework Search Paths.

And that's it. Just remember you did this when you update the node module, 'cause this change won't be versioned on your project.

*Note: If there are other people working on the project, do not remove ~/Documents/FacebookSDK from your project's Framework Search Paths. This is to be consistent with the module installation and the rest of the team can easily npm install and use the installation guide as documentation.

于 2017-06-21T01:37:38.123 回答
0

在 Xcode 中拖放 FacebookSDK 文件,例如尝试使用FBSDKCoreKit.h

于 2017-01-11T13:38:53.650 回答