我正在使用 Firebase,我的数据库如下所示:
Users
user1
email: "example1@test.com"
password: "pass1"
display name: "Name1"
user2
email: "example2@test.com"
password: "pass2"
display name: "Name2"
例如,在给定显示名称的情况下,我如何使用 Swift 3 检索电子邮件? (例如,如果我知道 Name1
,则检索到的数据将为 example1@test.com
。)
最佳答案
如下使用firebase
let dbstrPath : String! = "Users/user1"
self.dbRef.child(dbstrPath).observeSingleEvent(of: .value, with: { (snapshot) in
if snapshot.exists(){
print(snapshot.value!)
// Here you got user value in dict
}
})
关于ios - 检索给定特定字段的 Firebase 数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44628996/