I am using Parse as my backend for one of my native iOS app. I am not able to update a record on a table in Parse. First I query the object that I want to update it. So, "objects" array returns 1 record but when I want to update it I get the following error;
"object not found for update (Code: 101, Version: 1.2.16)"
So what do you think I can not update a record in Parse? (Below is my code)
Thanks, E.
PFQuery *query = [PFQuery queryWithClassName:@"askedFriends"];
[query whereKey:@"questionID" equalTo:aqDt.questionID];
[query whereKey:@"fbID" equalTo:FbId];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
NSArray *postArray = objects;
PFObject *post = postArray.lastObject;
[post setObject:@"sentReply" forKey:btnSelection];
[post saveInBackground];
}
I had the same problem, And it was the ACL column for that specific Class table. Ensure to have something like this in your ACL column
{"*":{"read":true},"tyb5CcKwBU":{"write":true,"read":true}}
The "*" allow the read to everyone. You can set client side using something like
ParseACL acl = new ParseACL(<YourObject>);
acl.setPublicReadAccess(true);
Error code 101 in Parse means :
101: Object doesn't exist, or has an incorrect password.
Obviously, your object exists since postArray returns 1 record, so we should look at something password-related. Maybe your "askedFriends" object have an PFACL object which disable the edition of this object if you are not log in with the PFUser associated.
On Parse website, go to Dashboard, then Data Browser and select your "askedFriends" class.
There is an ACL column, you should check it.
The error : "object not found for update (Code: 101, Version: 1.2.16)" append when the you try to save an object that the user does not have ACL access.
In order to let the user change the object you need to set PFACL permission when you create the object :
For a specific user :
PFObject *object = /*the object you want to save*/
NSString *userID = /*the objectID of the user you want to let perform modifications later*/
PFACL *groupACL = [PFACL ACL];
[groupACL setWriteAccess:YES forUserId:userID];
object.ACL = groupACL;
For a all users :
PFObject *object = /*the object you want to save*/
PFACL *groupACL = [PFACL ACL];
[groupACL setPublicWriteAccess:YES];
object.ACL = groupACL;
Using createWithoutData to set the referenced object helped me to solve this problem.
myObject.put("item", ParseObject.createWithoutData(<SUB CLASS>.class, <Your object item>));
myObject.saveInBackground();
I fixed this problem by changing the ACL string on the parse objects I want to be able to modify to the following and it fixed my problem:
{"*":{"read":true,"write":true}}
Hope that helps.
来源:https://stackoverflow.com/questions/22190264/i-can-not-update-a-record-in-parse-error-object-not-found-for-update-code-1