Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pointers data not storing in local database parse ios

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.'

like image 689
san Avatar asked Dec 20 '14 08:12

san


1 Answers

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."

like image 166
Ryan Kreager Avatar answered Nov 08 '22 09:11

Ryan Kreager