Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/20.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
我的应用程序只是在swift中显示我数据库的一个值_Swift_Database_Firebase - Fatal编程技术网

我的应用程序只是在swift中显示我数据库的一个值

我的应用程序只是在swift中显示我数据库的一个值,swift,database,firebase,Swift,Database,Firebase,当我从数据库(包括9或10个子数据库)读取数据时,它只显示最后一个值,其他标签为空 我感谢你的帮助 let Readuserdata = Database.database().reference().child("Users").child("Customers").child(userid) Readuserdata.observeSingleEvent(of: .value, with: { (snapshot) in let post = snapshot.value

当我从数据库(包括9或10个子数据库)读取数据时,它只显示最后一个值,其他标签为空

我感谢你的帮助

let Readuserdata = Database.database().reference().child("Users").child("Customers").child(userid)

    Readuserdata.observeSingleEvent(of: .value, with: { (snapshot) in
    let post = snapshot.value as! [String:Any]
        self.lblgiftprofile.text = post["discountcode"] as? String
        self.lblprofileusername.text = post["name"] as? String
        self.lblemailprofile.text = post["email"] as? String    
    })

这显示了最后一个标签,即“电子邮件”。所有其他值都为null,如果我将
lblemailprofile
放在第一行,它将为null,并且将出现
lblprofileusername

尝试将:。值的参数更改为其他类型,如.childAddedYou have.observeSingleEvent,它只抛出最后一个值,改变它。我实际上试过观察,但仍然是这样。另一件事是我不想添加子对象,我想读取数据,我的数据已经设置好了