Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix "Invariant Violation: requireNativeComponent: "RCTFBLoginButton" was not found in the UIManager."?

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

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

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. 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!

like image 893
Taly Hotimsky Avatar asked Nov 06 '22 22:11

Taly Hotimsky


1 Answers

I have been struggling with that a lot of time. After some investigation and several tries, I solved it this way:

  • Remove node_modules and ios/Pods
  • Upgraded to react-native 0.60
  • npm install
  • Added this to Podfile:
    pod 'FBSDKCoreKit'
    pod 'FBSDKLoginKit'
    pod 'FBSDKShareKit'
  • from ios folder: ```pod install ````

  • configure AppDelegate and Info.plist as this guide states

I did not have to manually drag the frameworks to the Xcode project as the guide say.

like image 129
lsantamaria Avatar answered Nov 14 '22 21:11

lsantamaria