Retrieve data from new Firebase

前端 未结 9 2855
醉梦人生
醉梦人生 2021-02-15 23:40

Please help. After migrating to new Firebase I can\'t retrieve data. Use this construction:

let ref = FIRDatabase.database().reference()

override func viewDidL         


        
9条回答
  •  臣服心动
    2021-02-16 00:22

    So, with mine, I also had a ref being declared immediately when the view controller was instantiated. I had to make it load after the app had been configured in the app delegate with FIRApp.configure().

    Before:

    let serverRef = Firebase("firebaseURL")
    

    After:

    lazy var serverRef = FIRDatabase.database().reference()
    

    This delays the instantiation of the database reference until its needed, which wont be until viewDidLoad on your initial view controller.

提交回复
热议问题