如何从Parse for iOS中检索多个对象

时间:2014-12-11 19:34:59

标签: ios parse-platform

我打算编写一个iOS应用来从Parse中检索对象。 documentation向您展示了如何检索特定对象(具有特定ID)。但我想根据表中的特定字段检索对象。

我该怎么做?

1 个答案:

答案 0 :(得分:1)

这样的事情:

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