Init IOS : Failed to get default FIRDatabase instance. Must call FIRApp.configure

(Please write your issue here along with the environment details below)

Environment

  1. Target Platform (e.g. iOS, Android):
    IOS
  2. Development Operating System (e.g. macOS Sierra, Windows 10):
    macOS Sierra
  3. Build tools (Xcode or Android Studio version, iOS or Android SDK version, if relevant):
    Xcode 8.3.3
  4. React Native version (e.g. 0.45.1):
    0.43.4
  5. RNFirebase Version (e.g. 2.0.2):
    1.0.10

Hi i have a problem on the first launch in IOS :

Exception ‘Failed to get default FIRDatabase instance. Must call FIRApp.configure() before using FIRDatabase.’ was thrown while invoking on on target RNFirebaseDatabase with params (
1,
“.info/serverTimeOffset”,
(
),
1,
value,
11
)

I had [FIRApp configure]; in my AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  NSURL *jsCodeLocation;

  jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];

  RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
                                                      moduleName:@"Shapevent"
                                               initialProperties:nil
                                                   launchOptions:launchOptions];
  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];
  [SplashScreen show];  // here
  [FIRApp configure];
  [[FBSDKApplicationDelegate sharedInstance] application:application
                           didFinishLaunchingWithOptions:launchOptions];
  return YES;
}

Can you tell me how i can ensure that firebase loaded before call RNFirebase.initializeApp(config.firebase)

No problem on Android.

Thanks.

Author: Fantashit

1 thought on “Init IOS : Failed to get default FIRDatabase instance. Must call FIRApp.configure

  1. @NachosSs what does [SplashScreen show] do? If this makes any reference to Firebase, then I’d suggest moving [FIRApp configure] higher in your didFinishLaunchingWithOptions method…

Comments are closed.