Reputation: 3012
I have PFUser object and it has firstName, lastName and 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. Below is the my code for it.
PFUser *user = [PFUser currentUser];
user[@"email"] = @"[email protected]"
[user saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
//UI refresh
}];
I received the following error : the email address [email protected] has already been taken (Code: 203, Version: 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 "[email protected]" but which is wrong, which should be "[email protected]".
FYI : I am also using parse offline store.
Upvotes: 1
Views: 548
Reputation: 228
Try to refresh the PFUser objects by using
[[PFUser currentUser] fetchInBackgroundWithBlock];
Refer the retrieving objects in parse iOS documentation (https://parse.com/docs/ios/guide#objects-retrieving-objects)
Upvotes: 0
Reputation: 4391
PFUser
class has special property for email. You can change email doing:
PFUser *user = [PFUser currentUser];
user.email = @"[email protected]"
Upvotes: 1