我有以下 Firebase 结构。 Firebase Structure
“用户”是根,键为“Uid”。我如何访问给定“Uid”的键的特定值?
示例:我想检索“Uid”为 M5j80aAlmCS3Jcbh0aA3T4Tfzxv1 的特定用户的“mobileno”。
最佳答案
要获取用户的个人资料信息,请使用 FIRUser 实例的属性。例如:
let user = Auth.auth().currentUser
if let user = user {
// The user's ID, unique to the Firebase project.
// Do NOT use this value to authenticate with your backend server,
// if you have one. Use getTokenWithCompletion:completion: instead.
let uid = user.uid
let email = user.email
let photoURL = user.photoURL
// ...
}
引用Firebase Documentation有关这方面的更多信息。
关于ios - 使用swift访问firebase中特定键的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46965650/