user3462448
user3462448

Reputation: 361

Firebase app not being configured

This randomly started happening and I cannot get passed it. My app crashes on launch with this in the debug area.

2016-10-29 14:31:57.606 gigMe[2285:73317] Firebase automatic screen reporting is enabled. Call +[FIRAnalytics setScreenName:setScreenClass:] to set the screen name or override the default screen class name. To disable automatic screen reporting, set the flag FirebaseAutomaticScreenReportingEnabled to NO in the Info.plist

2016-10-29 14:31:57.783 gigMe[2285] [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add [FIRApp configure] to your application initialization. Read more: gives google address that i cant post on here

2016-10-29 14:31:57.911 gigMe[2285:73317] * Terminating app due to uncaught exception 'FIRAppNotConfigured', reason: 'Failed to get default FIRDatabase instance. Must call FIRApp.configure() before using FIRDatabase.' * First throw call stack:

I really dont understand this at all because i havent messed with anything that has to do with the database and this is my didFinishLaunchingWithOptions method:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    // Override point for customization after application launch.
    print("wtf")
    FIRApp.configure()

    return true
}

im not getting anything printed in the debugger either. anyone know what is going on?

Upvotes: 12

Views: 14145

Answers (1)

Dravidian
Dravidian

Reputation: 9945

This is not FIRApp.configure() error. You might be declaring a global variable with some class function in any of your class, like

class viewCon : UIViewController{

let ref = FIRDatabase.database().reference() // or a Storage reference
    // This might be the error
   }

The reason why this happens is because , you are trying to initialise a variable with a class function/property which might not even be configured as of yet. So try this:-

 class viewCon : UIViewController{

    let ref : FIRDatabaseReference! 
       // This might be the error or a Storage reference

     override func viewDidLoad(){

       super.viewDidLoad()
       ref =  FIRDatabase.database().reference()
      }
  }

To support above theory, try using breakpoints on let ref = FIRDatabase.database().reference() and FIRApp.configure(), and see which one gets called first. If let ref = FIRDatabase.database().reference() is called first , you are bound to have this error, as ref is trying to access FIRDatabase class, which hasn't been configured yet..

Upvotes: 46

Related Questions