我用什么来观察单个事件?我尝试在互联网上搜索,但找不到任何有关它已被弃用的内容。我说它已被弃用,因为当我在 xcode 中键入该方法时,该方法被划掉了。
我应该定期观察,然后立即将其删除吗?
最佳答案
是吗,我还在用。尝试使用以下代码。您使用的是哪个 pod 版本的 firebase 以及 Xcode 版本?
let databaseRef = Database.database().reference()
databaseRef.child("Users").observeSingleEvent(of: DataEventType.value, with: { (snapshot) in
if snapshot.hasChild(strrr){
print("true rooms exist")
databaseRef.child("Users").child(strrr).child("Requests").child(emailIdCurrent).setValue("False")
}else{
print("false room doesn't exist")
}
})
关于ios - firebaseobserveSingleEvent 在 swift 中已弃用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45229342/