Firebase:标签文本上显示非常慢的数据

时间:2018-12-12 06:37:54

标签: swift firebase firebase-realtime-database

我正尝试观察我的Firebase数据库中的信息并将其存储在字典中,问题是当我尝试在标签上显示这些数据时需要花费大约30秒的时间,请您解决一下。

@objc func fetchUser() {

    let user = Auth.auth().currentUser
    if let user = user {

        let uid = user.uid
        let email = user.email

        ref?.child("users").child(uid).observeSingleEvent(of: .value, with: { (snapshot) in
            if let dictionary = snapshot.value as? [String : AnyObject] {
                print(dictionary)
                self.disName.text! = dictionary["DisplayName"] as! String
            }
        })

        disUID.text = uid
        disEmail.text = email
    }
}

0 个答案:

没有答案