在查询返回后,如何访问Parse.com对象的键/值对?

时间:2013-10-18 02:38:20

标签: objective-c nsarray parse-platform

我意识到这个问题可能有一个简单的答案,但我在查看Parse.com和许多其他资源的所有相关文档后都找不到它。以下是我正在查看的代码片段:

    PFUser *currentUser = [PFUser currentUser];


    PFQuery *query = [PFQuery queryWithClassName:@"ProfileInfo"];
    [query whereKey:@"userID" equalTo:[PFUser currentUser]];

    [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {

        /* What is the easiest way to pull the key/value pairs from the returned NSArray of PFobjects here? */
    }];

非常感谢任何帮助,提前谢谢!

1 个答案:

答案 0 :(得分:1)

for(PFObject *pfObject in objects){
    NSString *someValue = [pfObject objectForKey:@"someKey"];

    //or if it's a number
    NSNumber *someNumber = [pfObject objectForKey:@"someOtherKey"];
}