从 Firebase 检索数据以标记 'Swift Project'
Retrieving Data from Firebase to label 'Swift Project'
我应该使用什么函数将数据从 firebase 检索到标签的正确语法?
例如,我想检索电子邮件和密码 in the picture here
我试过下面这段代码,但没有用!它在模拟器中没有检索到任何东西!
ref.observeEventType(.Value, withBlock: {
snapshot in let m = snapshot.value.objectForKey("users/\(self.ref.authData.uid)/email") as? String
self.EmailLabel.text = m
})
试试这个
var ref = Firebase(url:"YOUR_URL_PATH/Users")
ref.observeEventType(.Value, withBlock: { snapshot in
let m = snapshot.value.objectForKey("Email")as?
self.EmailLabel.text = m
}, withCancelBlock: { error in
println(error.description)
})
希望这对您有所帮助...
我应该使用什么函数将数据从 firebase 检索到标签的正确语法?
例如,我想检索电子邮件和密码 in the picture here
我试过下面这段代码,但没有用!它在模拟器中没有检索到任何东西!
ref.observeEventType(.Value, withBlock: {
snapshot in let m = snapshot.value.objectForKey("users/\(self.ref.authData.uid)/email") as? String
self.EmailLabel.text = m
})
试试这个
var ref = Firebase(url:"YOUR_URL_PATH/Users")
ref.observeEventType(.Value, withBlock: { snapshot in
let m = snapshot.value.objectForKey("Email")as?
self.EmailLabel.text = m
}, withCancelBlock: { error in
println(error.description)
})
希望这对您有所帮助...