gpt4 book ai didi

swift - 使用 Swift 根据条件从 Firebase 数据库中获取数据

转载 作者:行者123 更新时间:2023-11-28 15:23:56 24 4
gpt4 key购买 nike

我有这样的数据库结构: enter image description here

如您所见,我有两个集合:“线程”和“用户”我需要接收所有 ownedIdwVlUM2Un9kNouOIlztKLvxxxPDh1 的线程,例如

最佳答案

您好,我在开发一个使用 firebase 作为后端服务的聊天应用程序时遇到过类似的情况。

你可以这样使用查询,我通过类似的查询做到了

    FireBase.Reference.threads
.queryOrdered(byChild: "ownerId")
.queryEqual(toValue: "YourUserId")
.observe(.value) { (snapshot) in
if let messages = snapshot.value as? NSDictionary {
// you will get all those threads where ownedId is what you need to fetch for
}
}

希望这对您有所帮助,如果需要任何更正,请告诉我。

关于swift - 使用 Swift 根据条件从 Firebase 数据库中获取数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45552127/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com