user3462448 user3462448 - 1 month ago 119
iOS Question

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?

Answer

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 configure 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()
      }
  }
Comments