lhencq
lhencq

Reputation: 505

Updating Saved Data in Parse iOS

I use this code to update my data on data browser on parse.

PFQuery *query = [PFQuery queryWithClassName:@"UserInformation"];

[query getObjectInBackgroundWithId:@"dIwnk9tbr0" block:^(PFObject *gameScore, NSError *error)
{
    gameScore[@"email_address"] = @"[email protected]";
    [gameScore saveInBackground];

}];

But I have this kind of error. And the data on parse is not changed.

2014-03-12 18:08:06.036 AndroidiOsPushTest[3725:1803] Error: object not found for update (Code: 101, Version: 1.2.18)

Upvotes: 1

Views: 2566

Answers (4)

user2500284
user2500284

Reputation: 11

    PFQuery *query = [PFUser query];
    [query getObjectInBackgroundWithId:objectID block:^(PFObject *UserInfo, NSError *error) {

        if (!error) {

           [UserInfo setObject:self.userName.text forKey:@"username"];
           [UserInfo setObject:@"US" forKey:@"country"];

            [UserInfo saveInBackground];
        }
        else {
            // Did not find any UserStats for the current user
            NSLog(@"Error: %@", error);
        }
   }];

Upvotes: 1

oscar castellon
oscar castellon

Reputation: 3138

From Parse.com (Hector Ramos)

    PFQuery *query = [PFQuery queryWithClassName:@"UserStats"];
[query whereKey:@"user" equalTo:[PFUser currentUser]];
[query getFirstObjectInBackgroundWithBlock:^(PFObject * userStats, NSError *error) {
  if (!error) {
    // Found UserStats
    [userStats setObject:newScore forKey:@"latestScore"];

    // Save
    [userStats saveInBackground];
  } else {
    // Did not find any UserStats for the current user
    NSLog(@"Error: %@", error);
  }
}];

Upvotes: 0

Evan Lin
Evan Lin

Reputation: 1322

It relate to ACL, please check your dashboard for the data column "ACL"

The write should lock on specific user ID. you need change it from your dashboard to update its permission to

{"*":{"write":true,"read":true}}

You can check more detail on my reply in this

Upvotes: 0

Michaël Azevedo
Michaël Azevedo

Reputation: 3894

Your issue looks like the one in : I can not update a record in Parse; Error: "object not found for update (Code: 101, Version: 1.2.16)"

Error code 101 in Parse means :

101: Object doesn't exist, or has an incorrect password.

First, you should check if your object exists and if the error is not null. Then, if these steps are successful, you should check for the ACL of the object : if you don't have permissions to edit it, you will be unable to save it and get the error 101.

Upvotes: 0

Related Questions