如果我使用[query includeKey@"someKey"]
方法
[query findObjectsInBackground]
返回nil
,当我不使用includeKey时,findObjectsInBackground按键返回对象@" someKey"但这个数组有空对象。
代码示例
PFQuery *query = [PFQuery queryWithClassName:@"PrimaryCategory"];
//[query includeKey:@"primaryIncomesCategories"];
[query fromLocalDatastore];
[query findObjectsInBackgroundWithBlock:^(NSArray *PF_NULLABLE_S objects, NSError *PF_NULLABLE_S error)
{
if (!error && objects.count)
{
self.primaryIncomesCategories = [self convertPFObjectToFBAPFCategory:objects.firstObject[@"primaryIncomesCategories"]];
}
if(completion)
completion();
}];
}
在日志中
primaryIncomesCategories = (
"<p><Category: 0x796f8dd0, objectId: eLiQQ0OCxV, localId: (null)> {\n}",
etc
如果取消注释&#34;查询includeKey&#34;比在日志中:
(lldb) po objects
nill
我以这种方式储蓄
[primaryCategory setObject:incomeCategoryArray forKey:@"primaryIncomesCategories"];
[primaryCategory pinInBackground];
incomeCategory array
是not nill
此数组not empty.