1

I can't retrieve the local data (pinned objects) after re-open the app.

I have this code in my controller:

- (IBAction)btnAddTouched:(id)sender
{
    PFObject *object = [PFObject objectWithClassName:@"Foobar"];

    [object setValue:[[NSDate date] description] forKey:@"data"];

    [object pinInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
        if (succeeded) {
            NSLog(@"Pinned OK");
        }else{
            NSLog(@"Erro: %@", error.localizedDescription);
        }
    }];
}

- (IBAction)btnLoadTouched:(id)sender
{
    PFQuery *query = [PFQuery queryWithClassName:@"Foobar"];

    [query fromLocalDatastore];

    [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
        if (!error) {
            NSLog(@"%@", objects);
        }else{
            NSLog(@"Erro: %@", error.localizedDescription);
        }
    }];
}

Steps to reproduce:

  1. Pin some objects with btnAddTouched:;
  2. Close the app (stop debbuging);
  3. Open the app again (build again);
  4. Try Load pinned data with btnLoadTouched;

It is retrieving me a object with localId: (null):

"<Foobar: 0x15d42770, objectId: new, localId: (null)> {\n    data = \"2014-12-15 21:00:05 +0000\";\n}"
    )

And after that the pinInBackgroundWithBlock: won't work anymore. The blocks is never called then.

  • Just a thought, but if you create a PFObject locally, and never properly save it to the cloud, the objectId is never set, which is what you see here. Seems elementary, unless i am missing something obvious. – drew.. Mar 10 '15 at 16:46

1 Answers1

0

The Parse iOS SDK release 1.6.1 fixed this bug.

  • I am having similar issue. [Please see Here](http://stackoverflow.com/questions/27578437/pointers-data-not-storing-in-local-database-parse-ios) . I have updated with the latest version v1.6.1, but still same issue – san Dec 22 '14 at 10:44
  • sorry to add another "me too" comment, but i'm seeing the same issue. pinned objects are not being found in the local datastore. i'm using the latest parse sdk. – ilyashev Dec 26 '14 at 16:06