App crashing when using Firebase Auth, reason: 'Default app has already been configured.'

前端 未结 9 1649
梦如初夏
梦如初夏 2020-12-13 23:34

I\'m building my first iOS application, and I am using Firebase to handle authentication, database, etc. I added a sign up screen and used the following code to create a new

9条回答
  •  醉梦人生
    2020-12-14 00:21

    If you're using Scene delegate from and you have more iOS versions like 9, 10 until 13, you must call in AppDelegate.swift in this way:

     if #available(iOS 13.0, *) {
     
     } else {
         FirebaseApp.configure()
     }
    

    And in SceneDelegate.swift this way:

     if #available(iOS 13.0, *) {
       FirebaseApp.configure()
     }
    

    These settings will exclude error like: *

    *** Terminating app due to uncaught exception 'com.firebase.core', reason: 'Default app has already been configured.'

提交回复
热议问题