Can't retrieve local data (pinned objects) from Parse Local Datastore

和自甴很熟 提交于 2019-12-11 10:24:13

问题


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.


回答1:


The Parse iOS SDK release 1.6.1 fixed this bug.



来源:https://stackoverflow.com/questions/27493200/cant-retrieve-local-data-pinned-objects-from-parse-local-datastore

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!