[英]Update users Email in Parse
I have PFUser object and it has firstName, lastName and Email. 我有PFUser对象,它具有firstName,lastName和Email。
When I try to update the user's email which is already exist, i am receiving error. 当我尝试更新已经存在的用户电子邮件时,我收到错误消息。 But when fetch the email from [PFUser currentUser], it returns wrong email, how to overcome this.
但是,当从[PFUser currentUser]获取电子邮件时,它将返回错误的电子邮件,如何解决此问题。 Below is the my code for it.
下面是我的代码。
PFUser *user = [PFUser currentUser];
user[@"email"] = @"test@gmail.com"
[user saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
//UI refresh
}];
I received the following error : the email address test@gmail.com has already been taken (Code: 203, Version: 1.7.4) 我收到以下错误:电子邮件地址test@gmail.com已被使用(代码:203,版本:1.7.4)
After this when fetching the email for current user 之后,在为当前用户获取电子邮件时
PFUser *user = [PFUser currentUser];
NSString *email = user[@"email"];
NSLog("email %@", email);
I received the following email "test@gmail.com" but which is wrong, which should be "tester@gmail.com". 我收到以下电子邮件“ test@gmail.com”,但这是错误的,应该是“ tester@gmail.com”。
FYI : I am also using parse offline store. 仅供参考:我也在使用解析脱机存储。
PFUser
class has special property for email. PFUser
类具有电子邮件的特殊属性。 You can change email doing: 您可以通过以下方式更改电子邮件:
PFUser *user = [PFUser currentUser];
user.email = @"test@gmail.com"
Try to refresh the PFUser objects by using 尝试通过使用刷新PFUser对象
[[PFUser currentUser] fetchInBackgroundWithBlock];
Refer the retrieving objects in parse iOS documentation ( https://parse.com/docs/ios/guide#objects-retrieving-objects ) 请参阅解析iOS文档中的检索对象( https://parse.com/docs/ios/guide#objects-retrieving-objects )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.