0

我的 PFQuery 返回以下描述。我正在尝试获取类的 objectId YouQuestions。例如:在下面的描述Ovx3B1TnaC中是 quesAray 的第一个索引的 objectId。但我不知道如何获取它。

Printing description of quesArray:
<__NSArrayM 0xe1198f0>(
<YouQuestions:OVx3BlTnaC:(null)> {
    askedUser = "<PFUser:XGvZsNyg9p>";
    attachedImage = "<PFFile: 0xb4c9d20>";
    category = Business;
    geoLocation = "<PFGeoPoint: 0xb4c9ea0>";
    question = "Who is kaka?";
    thumbImage = "<PFFile: 0xb4c9dd0>";
},

我就是这样做的,但返回 nil

PFQuery *fetchTimeLine = [PFQuery queryWithClassName:@"YouQuestions"]; [fetchTimeLine whereKeyExists:@"objectId"]; [fetchTimeLine findObjectsInBackgroundWithBlock:^(NSArray *quesArray, NSError *error) { for (int i =0; i<quesArray.count; i++) { PFObject *obj = [quesArray[i] objectForKey:@"objectId"]; [searchobjectIDsArray addObject:obj.objectId]; } }];

编辑:

我这样修

for (PFObject *object in quesArray) { NSLog(@"%@", object.objectId); }

4

1 回答 1

1

获取 id 数组:

NSArray *oids = [quesArray valueForKeyPath:@"objectId"];

于 2014-04-12T11:50:01.623 回答