Firebase not configured

It started by accident, and I can’t pass it on. My application crashes when starting with this in the debug area.

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

2016-10-29 14: 31: 57.783 gigMe [2285] [Firebase / Core] [I-COR000003] By default, the Firebase application is not yet configured. Add [FIRApp configure] to your application initialization. Details: gives a google address that I cannot post here.

2016-10-29 14: 31: 57.911 gigMe [2285: 73317] * Application terminated due to the uncaught exception "FIRAppNotConfigured", reason: "Failed to get the default FIRDatabase instance. Before using FIRDatabase, you must call FIRApp.configure (). '* First stack of throw calls:

I really don't understand this at all, because I havent messed up everything related to 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 doesn't get anything printed in the debugger. Does anyone know what is going on?

+7
ios swift3 xcode8 firebase
source share
1 answer

This is not a FIRApp.configure() error. You can declare a global variable with some class function in any of your classes, for example

 class viewCon : UIViewController{ let ref = FIRDatabase.database().reference() // or a Storage reference // This might be the error } 

The reason this happens is because you are trying to initialize a variable using a function / property of a class that is not yet configured. So try the following: -

  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 the theory above, try using breakpoints on let ref = FIRDatabase.database().reference() and FIRApp.configure() and see which one is called first. If let ref = FIRDatabase.database().reference() is called first, you should have this error because ref trying to access the FIRDatabase class, which is not yet configured.

+28
source share

All Articles