Firebase app not being configured

13,840

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..

Share:
13,840
user3462448
Author by

user3462448

Updated on June 13, 2022

Comments

  • user3462448
    user3462448 almost 2 years

    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?

  • Matt Bearson
    Matt Bearson over 7 years
    Thanks Dravidian. Note: there's a typo in your, otherwise terrific, answer. Capital R needed in var ref : FIRDatabaseReference!
  • Andoni Da Silva
    Andoni Da Silva about 6 years
    Thanks!! Dravidian