0
从Parse查询类和关键字。最终的结果应该从array
userPostsObjects
从PFQuerey中的数组获取最后一个对象
问题得到最后对象的关键text
是NSLog(@"FINAL OUTPUT %@", msgObject[@"text"]);
返回整个数组中的关键text
(上百个对象)不是最后目标
PFQuery *queryChatClass = [PFQuery queryWithClassName:@"Chat"];
[queryChatClass selectKeys:@[@"text",
@"user"]];
[queryChatClass findObjectsInBackgroundWithBlock:^(NSArray *userPostsObjects, NSError *error) {
if (!error) {
// Do something with the data
for (PFObject *msgObject in userPostsObjects) {
NSLog(@"FINAL OUTPUT %@", msgObject[@"text"]);
}
}
else {
// Log details of the failure
NSLog(@"Error: %@ %@", error, [error userInfo]);
}
}];
我最好的猜测是使用for (PFObject *msgObject in [userPostsObjects lastObject])
然而这会导致:'NSInvalidArgumentException', reason: '-[PFObject countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x14567300'
谢谢你,现在有道理 – JSA986