我的PFQuery返回以下描述。我試圖獲取 YouQuestions
的objectId。例如:在以下描述中,Ovx3B1TnaC
是第一個objectId quesAray的索引。但我不知道如何獲取它。如何在PARSE.com中從PFquery的NSArray獲取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); }
你的回答消除不必要的我的for循環:d – KhanXc