daspianist
daspianist

Reputation: 5525

Using PFQuery's containsAllObjectsInArray results in error

I have the following code, where I attempt to retrieve users based on an array of user IDs:

NSArray *userIDsWhoLikedPhoto = [self.photo objectForKey:@"usersThatLikedPicture"];

PFQuery *userQuery = [PFUser query];
[userQuery whereKey:@"objectId" containsAllObjectsInArray:userIDsWhoLikedPhoto];
[queryQuery findObjectsInBackground];

However, I always get the error "Error: $all only works on array fields (Code: 102, Version: 1.2.18)". I am not quite sure what I am doing wrong, since I am passing in an array as the query term.

Thanks!

Upvotes: 0

Views: 286

Answers (1)

daspianist
daspianist

Reputation: 5525

Figured this out:

[userQuery whereKey:@"objectId" containedIn:userIDsWhoLikedPhoto];

Upvotes: 1

Related Questions