无法从 Parse Local Datastore 检索本地数据(固定对象) [英] Can't retrieve local data (pinned objects) from Parse Local Datastore

查看:43
本文介绍了无法从 Parse Local Datastore 检索本地数据(固定对象)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

重新打开应用后,我无法检索本地数据(固定对象).

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);
        }
    }];
}

重现步骤:

  1. 使用 btnAddTouched: 固定一些对象;
  2. 关闭应用程序(停止调试);
  3. 再次打开应用(再次构建);
  4. 尝试使用 btnLoadTouched 加载固定数据;
  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;

它正在用 localId: (null):

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

之后 pinInBackgroundWithBlock: 将不再起作用.然后永远不会调用这些块.

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

推荐答案

Parse iOS SDK 1.6.1 版修复了此错误.

The Parse iOS SDK release 1.6.1 fixed this bug.

这篇关于无法从 Parse Local Datastore 检索本地数据(固定对象)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆