我使用以下代码将数据保存在一个 View 中:
let item1:String = textfield.text!
if TextField1.text != "" {
self.ref.child("userProfile").child((user!.uid)/value1Total").setValue(Double(item1)!)
}
在不同 View 中将保存的值设置为标签的代码是什么?
最佳答案
您可以尝试像下面的例子:
let name = nameTextField.text
let user: NSDictionary = ["name":name!,"dob":dateOfBirthTimeInterval]
//add firebase child node
let profile = firebase.ref.childByAppendingPath(name!)
// Write data to Firebase
profile.setValue(user)
看看这个 link欲了解更多信息
关于Swift 和 Firebase 3.x 保存和检索数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38004955/