0

I have a button where user can delete a friend:

it looks like this:

("self.otherUser" is a PFUser instance which contains the friend user to delete)

("friends" is an array field in the User table which contains friends ObjectIds)

PFQuery *deleteFriendQuery = [PFUser query]

[deleteFriendQuery whereKey:@"objectId" equalTo:[PFUser currentUser]];
[deleteFriendQuery whereKey:@"friends" equalTo:[self.otherUser objectId]];

[deleteFriendQuery getFirstObjectInBackgroundWithBlock:^(PFObject *object, NSError *error) {

            [object delete];
        }];

Nothing is deleted in the data browser, where am I wrong ? Does anyone knows a way to do this ?

Lkm
  • 113
  • 11
  • 1
    Excuse me, I believed that the "parse.com" tag suffices – Lkm Mar 13 '15 at 22:39
  • I somehow missed that. Sorry. Adding it to the subject is still a good idea since it draws people who know the particular framework you're working with (I've used a little Firebase but not Parse.) – Duncan C Mar 14 '15 at 00:31
  • Parse offers very good backend services, but for me the documentation miss of precisions for some cases – Lkm Mar 14 '15 at 14:57

2 Answers2

0

You are querying for a User object. User A does not have permission to delete User B.

picciano
  • 22,341
  • 9
  • 69
  • 82
  • do you have an idea ? – Lkm Mar 14 '15 at 16:45
  • Yes I know, the current code deletes a user, but what I'm trying to do is to remove the friend to delete's objectId from the array field called "friends" in my User table – Lkm Mar 14 '15 at 17:46
0

replace

 [object delete] 

for

 [object deleteInBackground];
  [object saveInBackground];
Erinson
  • 78
  • 8