ios - firebaseobserveSingleEvent 在 swift 中已弃用

标签 ios swift firebase

我用什么来观察单个事件?我尝试在互联网上搜索,但找不到任何有关它已被弃用的内容。我说它已被弃用,因为当我在 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/

相关文章:

ios - 在 iOS 8 模拟器中运行 .app 文件

swift - Moya 请求需要很长时间才能响应

javascript - 没有子节点之一的 Firebase 数据检索

javascript - 我已经使用 javascript/firebase 构建了应用程序,并希望它返回最后 5 个搜索并使每个搜索都可点击

firebase - Flutter 中从 Firestore 查询单个文档(cloud_firestore 插件)

ios - 在iOS中使用多个语音处理IO音频单元

ios - 显示使用 Cocoapods 的 Xcode 项目的所有原生 iOS 依赖项/框架

ios - UILabel Swift-3中显示的额外行

ios - 在 iOS 9.3.1 中获取位置权限后应用程序崩溃

ios - 在链接到 GameViewController 的游戏结束场景中展示插页式广告?