Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configured the default Firebase app __FIRAPP_DEFAULT

When following the flutter tutorial examples for adding firebase dependancies in the yaml file I would get this printout in the console "Configured the default Firebase app __FIRAPP_DEFAULT":

 dependencies:
  flutter:
    sdk: flutter
  firebase_core: ^0.4.0+6
  cloud_functions: ^0.4.0+2
  firebase_auth: ^0.11.1+7
  firebase_database: ^3.0.3
  firebase_storage: ^3.0.2

enter image description here

like image 428
Aaron Halvorsen Avatar asked Jun 27 '19 12:06

Aaron Halvorsen


2 Answers

In my particular workflow, when adding firebase dependencies, the tutorial code and flutter warnings never prompted to modify the AppDelegate.m file. It wasn't until I dialed back and added cloud_firestore did I get prompted with this warning:

6.3.0 - [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add [FIRApp configure]; (FirebaseApp.configure() in Swift) to your application initialization.

Read more: [https://firebase.google.com/docs/ios/setup#initialize_firebase_in_your_app].

  1. open xc workspace >> open ios/Runner.xcworkspace
  2. open AppDelegate.m
  3. in AppDelegate.m add the following line:

import Firebase;

  1. in AppDelegate.m add the following snippet to your application did finish method

[FIRApp configure];

Here is what mine looked like in the end:

enter image description here

like image 76
Aaron Halvorsen Avatar answered Sep 20 '22 14:09

Aaron Halvorsen


This worked for me: https://medium.com/vector-com-mm/how-to-fix-ios-crash-during-the-start-firebase-configure-f3477df3154

In AppDelegate.swift change the order of

GeneratedPluginRegistrant.register(with: self)
FirebaseApp.configure()

to:

FirebaseApp.configure() 
GeneratedPluginRegistrant.register(with: self)

clean and rebuild...

My AppDelegate.swift

import UIKit
import Flutter
import Firebase

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    FirebaseApp.configure()
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}
like image 44
Andy Cass Avatar answered Sep 22 '22 14:09

Andy Cass