ios - 为 iOS React-Native 项目设置 Fbsdk 框架

标签 ios xcode react-native cocoapods fbsdk

[巨大的更新]
有人给我发了这个,它更容易阅读以便使用 React Native 安装 fbsdk:https://developers.facebook.com/docs/react-native/getting-started-ios
但是,问题仍然是一样的:

Use of undeclared identifier 'UIUserInterfaceIdiomTV'

我猜这是来自 CocoaPods 拉取的内容的错误,因为 我能够制作 sample example只需删除相同的 UIUserInterfaceIdiomTV 即可工作案例(它曾经在开关中)。

但是,按照指南中的每一步并最终删除 UIUserInterfaceIdiomTV,我在自己的项目中遇到了新的编译问题:Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_FBSDKAppEvents", referenced from: objc-class-ref in AppDelegate.o "_OBJC_CLASS_$_FBSDKApplicationDelegate", referenced from: objc-class-ref in AppDelegate.o "_OBJC_CLASS_$_RCTRootView", referenced from: objc-class-ref in AppDelegate.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
如果有人可以帮助...
谢谢你的帮助!

最佳答案

我终于让 fbsdk 工作了(24/04/2016)。总结不同的步骤,以防您遇到相同的问题:

  • 如果您遇到The 'YourApp [Debug]' target overrides the 'OTHER_LDFLAGS' build setting...命令后的警告pod install , $(inherited)将添加到 主项目build设置而不是在 Pod 中
  • UIUserInterfaceIdiomTV 由于未知原因暂时无法识别,因此在 AppDelegate.m 中,如果您遇到错误,只需从开关
  • 中略过该案例即可。
  • info.plist 必须包含几行(尚未)在 sdk 安装指南中提及的行。这是您应该添加的完整列表: <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLSchemes</key> <array> <string>fb{your-app-id}</string> </array> </dict> </array> <key>LSApplicationQueriesSchemes</key> <array> <string>fbapi</string> <string>fb-messenger-api</string> <string>fbauth2</string> <string>fbshareextension</string> </array> <key>FacebookAppID</key> <string>{your-app-id}</string> <key>FacebookDisplayName</key> <string>{your-app-name}</string>

  • 不要忘记将 {your-app-id} 替换为...您的应用程序 ID,并将 {your-app-name} 替换为您的应用程序名称。
    祝大家好运!

    关于ios - 为 iOS React-Native 项目设置 Fbsdk 框架,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36878592/

    相关文章:

    ios - 居中 UIView

    ios - 当我在 xCode 5 中验证我的应用程序时,出现错误的广告标识符 [IDFA] 使用情况

    ios - UIImageView 和 UIButton 背景图像在模拟器中加载时变黑

    javascript - Redux React-Native(在 react-redux 中使用 useSelector 与使用 connect 有什么区别?)

    reactjs - react native : Assigning value with setState()

    reactjs - 使用 React Immutability Helpers 处理多个突变的正确方法

    iOS-调用电话号码而不共享号码

    ios - iPhone SDK WebRTC 集成错误

    objective-c - 接口(interface)类型不能静态分配?

    ios - 防止多个声音文件在播放时重叠