1

I am using the Parse framework and have it set up where I can login and access the user who logs in PFUser object. I want to be able to visit a friends page and to do this i need to query and retrieve data (names and other pieces of information) of a PFUser object which is not the on that is logged in. I cannot find any queries that let me access data from the User class. I hope this makes sense,

Thanks

Oli Black
  • 441
  • 2
  • 9
  • 23

1 Answers1

0

It really depends on what sort of criteria you want to search on, but you can query PFUsers just like you would any other PFObject within Parse. The only difference is that you create your query with the +[PFUser query] method. Here's an example from Parse's documentation:

PFQuery *query = [PFUser query];
[query whereKey:@"gender" equalTo:@"female"]; // find all the women
NSArray *girls = [query findObjects];

You can also query where a user is an associated object on some other class in Parse, and you can also handle results asynchronously:

PFQuery *query = [PFQuery queryWithClassName:@"Post"];
[query whereKey:@"user" equalTo:user];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
  // do something with results
}];

Check out the query documentation for other examples of the sorts of things you can do with queries.

James Frost
  • 6,960
  • 1
  • 33
  • 42