0

React Native Firebase won’t install on iOS React Native project. It works fine on Android.

I followed this instruction. https://rnfirebase.io/docs/v5.x.x/installation/initial-setup I set up Firebase, added the downloaded plist file via XCode, installed and set up Cocoapod.

The moment I add the following line to my App.js, the simulator returns an error message.

  import firebase from 'react-native-firebase';

The error message: “RNFirebase core module was not found natively on iOS”

I’ve tried a few things I picked up from this forum: https://github.com/invertase/react-native-firebase/issues/614

I commented out following lines from Podfile

use_frameworks!

And then pod install, pod update

on Xcode, checked the Build Phases/ Link Binary with Libraries section. I checked libRNFirebase.a was already there.

I've been trying this for a few months now on and off. And I haven't found a way to make React Native Firebase install on iOS project. Any pointer would be much appreciated.

L.U.
  • 501
  • 5
  • 20

1 Answers1

0

I'm currently maintaining the react-native-firebase v5 branch (current stable) and we do have a problem with the header search paths right now for some reason.

I don't have a definitive fix, but I constructed a demo that goes from react-native init, then installs react-native-firebase, and does all the things necessary such that the project builds and runs on iOS and even archives in release mode.

You may see it here: https://github.com/mikehardy/rnfbdemo

The only thing that is important at the moment is that you need to put one non-documented thing in your Podfile after following all the install instructions, as the last line before the final end

  system("mkdir -p Pods/Headers/Public/FirebaseCore && cp Pods/FirebaseCore/Firebase/Core/Public/* Pods/Headers/Public/FirebaseCore/")
Mike Hardy
  • 2,274
  • 3
  • 25
  • 57
  • Thank you! Adding that one line before the final "end" in the Podfile did the trick for me. Although, Adding the Analytics package broke it again. So I commented out that pod. When the Podfile has only "Core" and "AdMob", this worked for me. – L.U. Jun 22 '19 at 21:04
  • I tried the same method for another iOS app. And this time, the simulator gave me a new error: "You attempted to use a firebase module that's not installed natively on your iOS project by calling firebase.admob()." Interesting! I will have to look up on that one. At least, one of my apps is working now. – L.U. Jun 22 '19 at 21:37
  • I am currently seeing the same thing with firebase.admob() right now, trying to integrate it on iOS in rnfbdemo, so you're not alone. I'll update when I have a solution, otherwise can post a bug on rnfbdemo then you'll get notified there. – Mike Hardy Jun 23 '19 at 03:15
  • Yes, and it's posted in my answer? With a working link to a demonstration repository? – Mike Hardy Jul 26 '19 at 17:23
  • I see the update. Thanks! It looks very comprehensive. I will go through it shortly. – L.U. Jul 28 '19 at 21:11
  • Oh - actually I see you were looking for a "real" solution really, other than the objectively terrible hack of copying the headers. I can't say I have a real solution for react-native 0.59 and I'm not sure I/we will ever have one, as it does not appear to be necessary for RN60 – Mike Hardy Jul 28 '19 at 21:25
  • I see. It looks like React Native 0.60 is the recommended version. That's good to know. I installed a blank React Native 60 and recreated the app. I managed to install React Native Firebase, including AdMob. Thanks! It's throwing an error at the "Archive" stage. But at least I'm past this particular deadlock. Thank you very much for your help. – L.U. Jul 29 '19 at 16:52
  • @MikeHardy Mike, can you help me with my problem? I have spent days on this.. Having this problem while migrating from v5 to v6. https://stackoverflow.com/questions/63117069/rnfirebase-core-module-was-not-found-natively-on-ios-migrating-from-react-nati – honor Aug 01 '20 at 14:31
  • @honor - probably not, I am sorry, but I have a script that shows a full v6+ integration: https://github.com/mikehardy/rnfbdemo/blob/master/make-demo-v6.sh - follow that and do what it does, and it should work – Mike Hardy Aug 02 '20 at 20:57