Firebase observeSingleEvent不调用回调函数ios

时间:2016-12-22 03:35:19

标签: ios firebase swift3 firebase-realtime-database promisekit

我的Firebase引用没有调用observeSingleEvent的回调。

 let uid = FIRAuth.auth()?.currentUser?.uid

 FIRDatabase.database().reference().child("users").child(uid).observeSingleEvent(of: .value, with: { (snapShot) in                    
           //code here not called
        }) { (error) in
           //code here not called either
        }

在我的情况下,当我在Firebase环境之间切换(使用不同的开发和暂存.plist文件构建)时,似乎来自FIRAuth.auth()?.currentUser?.uid的uid属性以某种方式从先前的应用安装中缓存。 / p>

但是,如果我只是添加一个随机的非现有字符串来代替uid,则回调会按预期发生,并且缺少参考节点的空快照。

我认为有必要提一下我使用同步的Firebase引用并使用persistanceEnabled = true。

我正处于我在环境之间切换并且我的应用程序挂起的情况,因为承诺未被履行或拒绝,因为observeSingleEvent方法调用的结果永远不会完成。

0 个答案:

没有答案