Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/116.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 无法使用swift 3在firebase中节点特定值_Ios_Iphone_Firebase_Swift3_Firebase Realtime Database - Fatal编程技术网

Ios 无法使用swift 3在firebase中节点特定值

Ios 无法使用swift 3在firebase中节点特定值,ios,iphone,firebase,swift3,firebase-realtime-database,Ios,Iphone,Firebase,Swift3,Firebase Realtime Database,我能够获取所有用户,但我需要特定于用户ID的数据。 例如,您可以在这里看到许多用户已注册,但我只需要3个节点的详细信息: 323QGP6qryTWs7EnnXRX1stgocP2 iy5ssz0ALphtgViALEOG0N4TeGd2 OlA0rhAVfsNvixe8KEsUmdCfuN42 请帮忙拿这些记录 谢谢。你能展示你尝试过的代码吗?让ref=Database.Database().reference().child(“用户”).child(“7DQW2CKP8ZQVQBJZRAGRR

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

iy5ssz0ALphtgViALEOG0N4TeGd2

OlA0rhAVfsNvixe8KEsUmdCfuN42

请帮忙拿这些记录


谢谢。

你能展示你尝试过的代码吗?让ref=Database.Database().reference().child(“用户”).child(“7DQW2CKP8ZQVQBJZRAGRRZS8Z2”).child(“请求”).queryOrdered(by child:“OlA0rhAVfsNvixe8KEsUmdCfuN42”).queryEqual(toValue:true)ref.observe(.value,with:{(快照:DataSnapshot)打印(“获取请求:(快照)”})这不是我要找的。节点无法硬编码,因为节点将随机出现。另外,我不想检索所有用户,因为有成千上万的用户。谢谢你的回复。如果你不知道钥匙的话。而且您不希望至少检索一次所有用户。您希望如何获得3个特定的用户节点?请查看此示例,让ref1=xyz/(uid)/请求此路径将包含一些uid:{uid1=true uid2=true},然后,让ref1=xyz/(uid)/用户返回:{uid1:{user details}uid2:{user details}因此,我需要用户各自uid的详细信息从用户列表中,您在哪里找到请求?在你的uid下?或者每个uid都有一个请求节点?每个uid都有一个请求节点。谢谢
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.
       }
    }
})