Retrieve data from new Firebase

前端 未结 9 2827
醉梦人生
醉梦人生 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:31

    Had the same problem. I looked for linking problems that are related to the plist but that wasn't the problem. I thought maybe it has caused because of that my initial view controller is revoked before the configurations are completed. I solved the problem by experimenting a bit.

    My initial view controller was this:

        let ref = FIRDatabase.database().reference()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    
    }
    

    I've changed that to this:

        var ref = FIRDatabaseReference.init()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        ref = FIRDatabase.database().reference()
    
        // Do any additional setup after loading the view, typically from a nib.
    
    }
    

    Crash resolved.

提交回复
热议问题