I can not update a record in Parse; Error: “object not found for update (Code: 101, Version: 1.2.16)”

梦想的初衷 提交于 2019-11-29 09:23:09

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.

ant_one

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!