My PFQuery returns the following description.I am trying to fetch the objectId of the class YouQuestions
.For eg: in the below description Ovx3B1TnaC
is the objectId for the first index of quesAray. But I have no idea on how to fetch it.
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>";
},
This is how I did but returned 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 (int i =0; i<quesArray.count; i++) { PFObject *obj = [quesArray[i] objectForKey:@"objectId"]; [searchobjectIDsArray addObject:obj.objectId]; } }];
EDIT:
I fixed it like this
for (PFObject *object in quesArray) { NSLog(@"%@", object.objectId); }
获取ID数组:
NSArray *oids = [quesArray valueForKeyPath:@"objectId"];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.