Error message - RNFirebase core module was not fou

2019-08-25 09:34发布

问题:

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.

回答1:

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/")