如何修复“不变违规:requireNativeComponent:“RCTFBLoginButton"没有在 UIManager 中找到."? [英] How to fix "Invariant Violation: requireNativeComponent: "RCTFBLoginButton" was not found in the UIManager."?

查看:51
本文介绍了如何修复“不变违规:requireNativeComponent:“RCTFBLoginButton"没有在 UIManager 中找到."?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先让我说类似的 SO 问题表明问题可能与没有链接库有关.

Let me start by saying that similar SO questions suggest the problem may be related to not having linked the lib.

我再次运行 react-native link react-native-fbsdk,以确认它确实已链接,并确认它是

I've ran react-native link react-native-fbsdk again, to confirm it was indeed linked, and confirmed it was

rnpm-install info Platform 'ios' module react-native-fbsdk is already linked
rnpm-install info Platform 'android' module react-native-fbsdk is already linked

不过,我在 红色指示>main.jsbundlelibReact.alibRCTFBSDK.a(我觉得特别令人不安的是在恢复的引用"下显示,并指​​向当我尝试在 Finder 中找到它时无处可去).所以,总而言之,强烈的迹象表明我的 FBSDK 设置出了问题.

Still, I see a couple of red indications in my XCode project for main.jsbundle, libReact.a and libRCTFBSDK.a (which I find especially disturbing to be showing under "Recovered References", and to be pointing to nowhere when I try to locate it in Finder). So, all in all, strong indications that something (or some things) went wrong with my FBSDK setup.

因为设置指南中提到了这些,所以让我继续报告:

Because these are mentioned in the setup guides, let me go ahead an report that:

  1. 我已经下载了 SDK,它被解压到我的 ~/Documents/FacebookSDK 文件夹下
  2. 我已将 4 个框架(BoltsFBSDKCoreKitFBSDKLoginKitFBSDKShareKit)拖入项目中, 不标记复制"选项
  3. 我的构建设置">>框架搜索路径"具有 ~Documents/FacebookSDK 的价值(仅此而已,仅此而已)
  4. 我的构建设置">>其他链接器标志"具有 -ObjC -lc++ 值(已经如此,我没有碰它,只是确认它有 ObjC,根据 Facebook 指南)
  5. 我的构建阶段">>将二进制文件与库链接"有 4 个框架,以及其他几个文件,包括树中红色的两个文件(libReact.alibRCTFBSDK.a)
  1. I've downloaded the SDK, which is extracted under my ~/Documents/FacebookSDK folder
  2. I've dragged the 4 frameworks (Bolts, FBSDKCoreKit, FBSDKLoginKit, FBSDKShareKit) into the project, not marking the "Copy" option
  3. My "Build Settings" >> "Framework Search Paths" has ~Documents/FacebookSDK for value (and just that, nothing else)
  4. My "Build Settings" >> "Other Linker Flags" has -ObjC -lc++ for value (this was already so, I didn't touch it, just confirmed it had ObjC, per Facebook's guide)
  5. My "Build Phases" >> "Link Binary With Libraries" has the 4 frameworks, plus several others files, including the two that are in red in the tree (libReact.a and libRCTFBSDK.a)

虽然问题似乎确实源于那些红色文件,但我没有线索或运气试图修复它们,因此感谢您的帮助!

While it does seem the problem is rooted in those red files, I'm out of clues or luck in trying to fix them, so any help is appreciated!

推荐答案

截至本期,react-native-fbsdk github 表示 本指南 应该遵循,除了第 2 步(链接 SDK),而是将框架拖到项目中.这类似于您从 FB 仪表板内部获得的快速入门"指南中所指示的内容.这两个指南都是我所看到问题的根源.

As of the moment of this issue, the react-native-fbsdk github indicates this guide should be followed, with the exception of step 2 (Linking the SDK), with the frameworks being dragged into the project instead. That's similar to what's indicated at the "Quick Start" guide you get to from inside FB's Dashboard. Both those guides were the source of the issues I was seeing.

遵循本指南反而让它起作用了.

Following this guide instead got it working.

这篇关于如何修复“不变违规:requireNativeComponent:“RCTFBLoginButton"没有在 UIManager 中找到."?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆