问题
I have a query with many includeKeys which are pointers to another class. After receiving the data from parse cloud all the records are getting stored locally using pinAll method. When I fetch back the results stored, I can able to get the records but not pointers included. See sample code below
[query includeKey:@"classOne.innerClass"];
[query includeKey:@"classTwo.innerClass"];
[query includeKey:@"classThree"];
[query includeKey:@"classFour"];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error){
[PFObject pinAllInBackground:objects withName:@"LocalRecords" block:^(BOOL succeeded, NSError *error) {
}];
}];
And I am fetching the records like
PFQuery *lquery = [PFQuery queryWithClassName:[ClassName parseClassName]];
[lquery fromPinWithName:@"LocalRecords"];
BFTask *btask = [[lquery findObjectsInBackground] continueWithSuccessBlock:^id(BFTask *task) {
if (task.error) {
NSLog(@"Error: %@", task.error);
return task;
}
}];
When I try to access any of the columns in classOne, classTwo, classThree and classFour I am getting an exception Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Key "name" has no data. Call fetchIfNeeded before getting its value.'
回答1:
This was a bug in the Parse.com local data store functionality for iOS.
From the 1.6.3 release notes:
"Improved consistency of Local Datastore / Parse queries with includeKey: and NSNull values."
来源:https://stackoverflow.com/questions/27578437/pointers-data-not-storing-in-local-database-parse-ios