【发布时间】:2016-03-09 09:31:44
【问题描述】:
如何更新 firebase 中的用户信息! 比如他的邮箱、密码、姓名等。
我会使用什么 firebase 功能?
【问题讨论】:
标签: ios xcode swift email firebase
如何更新 firebase 中的用户信息! 比如他的邮箱、密码、姓名等。
我会使用什么 firebase 功能?
【问题讨论】:
标签: ios xcode swift email firebase
这是一个非常模糊的问题,有很多答案,但这里是基础知识。
假设您有这样的 Firebase 结构
users
uid_0
user_name: "Bill"
email: "bill@yipee.com"
要将用户名从 Bill 更改为 Leeeeroy:
var userNameRef = ref.childByAppendingPath("users/uid_0/user_name")
userNameRef.setValue("Leeeeroy")
以上是一个小例子。您也应该使用 .updateChildValues 进行调查。
Firebase 网站上有一个非常好的数据写入指南,请查看!
如果您正在考虑修改实际的 Firebase 用户数据,而不是您创建的用户节点,请查看
- (void)changeEmailForUser:(NSString *)email 密码:(NSString *)password toNewEmail:(NSString *)newEmail withCompletionBlock:(void (^)(NSError *error))block
这是更改用户 Firebase 电子邮件的简单快速代码
myRootRef.changeEmailForUser("bob@thing.com", password: "old_password", toNewEmail: "new_password") { (<#NSError!#>) -> Void in
print("done!")
}
【讨论】: