gpt4 book ai didi

ios - 无法使用 swift 3 在 firebase 中指定特定值的节点

转载 作者:行者123 更新时间:2023-11-29 00:09:57 26 4
gpt4 key购买 nike

 My firebase database looks like this

我能够获取所有用户,但我需要用户 ID 特定数据。例如,您可以在这里看到很多用户已注册,但我只需要 3 个节点的详细信息: 323QGP6qryTWs7EnnXRX1stgocP2

iy5ssz0ALphtgViALEOG0N4TeGd2

OlA0rhAVfsNvixe8KEsUmdCfuN42

请帮助获取这些记录。

谢谢。

最佳答案

let ref = Database.database().reference().child("users").observeSingleEvent(of: .value, with : { snapshot in {
if snapshot is NSNull{
//handles errors
}
else{
let dict = snapshot.value as? NSDictionary{
let firstDict = dict["323QGP6qryTWs7EnnXRX1stgocP2"] as? NSDictionary
let secondDict = dict["iy5ssz0ALphtgViALEOG0N4TeGd2"] as? NSDictionary
let thirdDict = dict["OlA0rhAVfsNvixe8KEsUmdCfuN42"] as? NSDictionary


//Then to gather whichever node you want inside these users:
let requestedNode = THEDICTIONARYYOUARELOOKINGAT["THE_NAME_OF_THE_NODE"] as? String //String, Int, Dictionary, array, boolean, ect.
}
}
})

关于ios - 无法使用 swift 3 在 firebase 中指定特定值的节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46765364/

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