我有一个PFObject
,其中一些键包含指针。有时我不会在原始查询中包含这些内容。如何为现有对象获取这些内容?我是否必须组建一个全新的PFQuery
?
答案 0 :(得分:1)
接受的答案不正确。 OP表示有时相关对象不包含在原始查询中,并询问是否需要另一个查询。
includeKey用于原始查询。如果没有包含对象,正确的方法是使用fetchIfNeeded: https://parse.com/docs/ios/api/Classes/PFObject.html#//api/name/fetchIfNeeded
PFObject *department = user[@"department"];
// If includeKey was not used for department in the original query, department is now only a stub pointing to the actual object.
[department fetchIfNeededInBackgroundWithBlock:^(PFObject *object, NSError *error) {
NSString *departmentName = department[@"name"];
}];