Reputation: 29064
I intend to write an iOS app to retrieve objects from Parse. The documentation shows you how to retrieve a particular object (with certain id). But I want to retrieve objects based on a particular field in the table.
How do I do it?
Upvotes: 1
Views: 394
Reputation: 7667
Something like this:
PFQuery *query = [PFQuery queryWithClassName:@"GameScore"];
[query whereKey:@"playerName" equalTo:@"Dan Stemkoski"];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
if (!error) {
// The find succeeded.
NSLog(@"Successfully retrieved %d scores.", objects.count);
// Do something with the found objects
for (PFObject *object in objects) {
NSLog(@"%@", object.objectId);
}
} else {
// Log details of the failure
NSLog(@"Error: %@ %@", error, [error userInfo]);
}
}];
https://www.parse.com/docs/ios_guide#queries-basic/iOS
Upvotes: 1