如果我将sdk文件夹放在react-native项目中,Facebook sdk无法正常工作?

时间:2017-05-29 07:23:09

标签: ios facebook react-native facebook-sdk-4.0 react-native-fbsdk

我想手动链接Facebook SDK,因为我们不使用cocoapods&不想实施它。但出于某种原因,当我们在buddybuild上构建我们的应用程序时,它将失败。

我所做的是把FacebookSDK文件夹放在里面(不是我知道的最佳解决方案):

ios/<ProjectName>/FacebookSDK

我将此文件夹($(SRCROOT)/ios/<ProjectName>/FacebookSDK))添加到框架搜索标题路径&amp;它似乎仍然会抛出错误。

1850
    ▸ Compiling RCTFBSDKShareDialog.m
1851
    » In file included from node_modules/react-native-fbsdk/ios/RCTFBSDK/share/RCTFBSDKShareDialog.m:19:
1852
    ✗ node_modules/react-native-fbsdk/ios/RCTFBSDK/share/RCTFBSDKShareDialog.h:21:9: fatal error: 'FBSDKShareKit/FBSDKShareKit.h' file not found
1853
    » #import <FBSDKShareKit/FBSDKShareKit.h>
1854
    »         ^
1855
    ▸ Compiling RCTFBSDKAppEvents.m
1856
    » In file included from node_modules/react-native-fbsdk/ios/RCTFBSDK/core/RCTFBSDKAppEvents.m:19:
1857
    ✗ node_modules/react-native-fbsdk/ios/RCTFBSDK/core/RCTFBSDKAppEvents.h:21:9: fatal error: 'FBSDKCoreKit/FBSDKCoreKit.h' file not found
1858
    » #import <FBSDKCoreKit/FBSDKCoreKit.h>
1859
    »         ^
1860
    ** BUILD FAILED **
1861
    The following build commands failed:
1862
        CompileC /tmp/sandbox/582d62aa1d76fc0100f1f6dd/bbbuild/Build/Intermediates/RCTFBSDK.build/Release-iphoneos/RCTFBSDK.build/Objects-normal/armv7/RCTFBSDKAppEvents.o RCTFBSDK/core/RCTFBSDKAppEvents.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
1863
    (1 failure)

我能做什么的想法?如果我们现在可以使用这个解决方案,那就好了,这样所有开发人员(和buddybuild CI)都可以提取它,而不必下载SDK并将其放入文档文件夹。

1 个答案:

答案 0 :(得分:3)

这通常是由于FBSDK依赖关系的位置配置不正确而导致的。

如果你看一下:https://github.com/facebook/react-native-fbsdk/blob/master/ios/RCTFBSDK.xcodeproj/project.pbxproj

您会注意到RCTFBSDK将在以下两个位置之一中查找依赖项:

~/Documents/FacebookSDK
$(PROJECT_DIR)/../../../ios/Frameworks

第二个选项是像buddybuild这样的持续集成系统的正确选项。

换句话说,您必须将您的FBSDK依赖项放在“ios / Frameworks”文件夹下,以便它可以在持续集成系统上运行。

您可以找到有关此in our react-native documentations的更多信息。

如果有帮助,请告诉我!