0
votes

I am currently using Parse.com's API.

What I am trying to accomplish: I am trying to return an array of PFUser Objects. In each PFUser, there is a key for "friends" & and key for "username". The "friends" field is an array of username strings. So what I need to do is return an array that is full of the actual PFUser objects in which each object's username matches with one from the array of username strings / "friends"

What I have been trying to do:

PFQuery *query = [PFQuery queryWithClassName:@"User"];
NSArray *myArray = (NSArray*)[[PFUser currentUser]objectForKey:@"friends"];
[query whereKey:@"username" containedIn:myArray];

[query findObjectsInBackgroundWithBlock:^(NSArray *results, NSError *error) {
    // results will contain users with a hometown team with a winning record
    NSLog(@"Results = %@",results);
}];

This keeps returning an empty array. If anyone could point me in the right direction, or help explain what I might be doing wrong, it would be greatly appreciated!

1

1 Answers

0
votes

PFUser is private.

You only can watch your own user data.

You need to create another table related to User (easy with pointers) where you save the data you want to share (friends in your case).