ewizard
ewizard

Reputation: 2862

Parse error when updating user info with currentUser

I am trying to update a custom column (@"matches") for [PFUser currentUser] however I am receiving this error:

PFKeychainStore failed to set object for key 'currentUser', with error: -34018

...using this code:

NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];

PFUser *currentUser = [PFUser currentUser];
    if (currentUser) {
        NSLog(@"there is a current user");

       [currentUser setObject:matchesNumber.text forKey:@"matches"];

       [currentUser saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
           if (!error) {
               // The currentUser saved successfully.
           } else {
               // There was an error saving the currentUser.
           }
       }];
       } else {
           [PFUser logInWithUsernameInBackground:[userDefaults objectForKey:@"pfuser"] password:[userDefaults objectForKey:@"pfpass"]
               block:^(PFUser *user, NSError *error) {
                   if (user) {
                       NSLog(@"user logged in");

                      [user setObject:matchesNumber.text forKey:@"matches"];

                      [user saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
                      if (!error) {
                          // The currentUser saved successfully.
                      } else {
                          // There was an error saving the currentUser.
                      }
                  }];
                  } else {
                      NSLog(@"login failed");
                      // The login failed. Check error to see why.
                  }
              }];
          }

I figure the redundancy can't hurt, and I updated my Parse SDK to make sure that wasn't the problem, as for a few other people, it was. What am I doing wrong?

Upvotes: 0

Views: 330

Answers (1)

Marius Waldal
Marius Waldal

Reputation: 9942

This might be a bug in Parse. See if you can find similarities in this issue: https://github.com/ParsePlatform/Parse-SDK-iOS-OSX/issues/437

Upvotes: 1

Related Questions