Saving user causes object not found error

前端 未结 3 2184
说谎
说谎 2020-12-12 06:08

Saving a user causes Error: object not found for update (Code: 101, Version: 1.2.19)

   [PFGeoPoint geoPointForCurrentLocationInBackground:^(PFGeoPoint *geoP         


        
3条回答
  •  青春惊慌失措
    2020-12-12 06:32

    The error : "object not found for update" 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*/
    NSString *userID = /*the objectID of the user you want to let perform modifications later*/
    PFACL *groupACL = [PFACL ACL];
    [groupACL setPublicWriteAccess:YES];
    object.ACL = groupACL;
    

提交回复
热议问题