1
votes

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.

2
What are you ACLs for users set at?= - Larry Pickles
user - read , write is the ACL - Arasuvel
did you try Njuri's answer? - Larry Pickles

2 Answers

1
votes

PFUser class has special property for email. You can change email doing:

PFUser *user = [PFUser currentUser];
user.email = @"[email protected]"
0
votes

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)