2
votes

I am trying to use react-native-firebase module with react native.

Error I am getting:

enter image description here

Steps I followed:

Step1: Created basic app

react-native init myFirebaseApp

Moved to project

cd myFirebaseApp

Installed module

npm install --save react-native-firebase

Step 2: Setup Firebase SDK (https://rnfirebase.io/docs/v4.2.x/installation/ios)

created firebase app and downloaded GoogleService-Info.plist for iOS

copied

GoogleService-Info.plist

in project, then

pod init

Add these line to pod file

  pod 'Firebase/Core'
  pod 'Firebase/Firestore'

Installed dependencies

pod install

and finally linked library

react-native link

Someone can guide me what I am missing or doing wrong?

1
what about AppDelegate.m file? rnfirebase.io/docs/v4.2.x/installation/…Ivan Chernykh

1 Answers

5
votes

Modify your AppDelegate.h and AppDelegate.m files

In AppDelegate.h add this,

#import <Firebase.h>

And in AppDelegate.m add [FIRApp configure];

#import <React/RCTRootView.h>
#import <ReactNativeNavigation/ReactNativeNavigation.h>

@implementation AppDelegate

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  [FIRApp configure]; // <=== Add this line

  NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
  [ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions];

  return YES;
}

@end