指针数据不存储在本地数据库中,解析ios [英] Pointers data not storing in local database parse ios

查看:189
本文介绍了指针数据不存储在本地数据库中,解析ios的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含许多includeKeys的查询,它们是指向另一个类的指针。从解析云接收到数据后,所有记录都将使用 pinAll 方法在本地存储。当我回收存储结果时,我可以获取记录,但不能包含指针。

  [query includeKey:@classOne.innerClass]; 
[query includeKey:@classTwo.innerClass];
[query includeKey:@classThree];
[query includeKey:@classFour];
[查询findObjectsInBackgroundWithBlock:^(NSArray *对象,NSError *错误){
[PFObject pinAllInBackground:objects withName:@LocalRecordsblock:^(BOOL succeeded,NSError * error){

}];
}];

我正在获取记录,如

  PFQuery * lquery = [PFQuery queryWithClassName:[ClassName parseClassName]]; 
[lquery fromPinWithName:@LocalRecords];
BFTask * btask = [[lquery findObjectsInBackground] continueWithSuccessBlock:^ id(BFTask * task){
if(task.error){
NSLog(@Error:%@,task错误);
返回任务;
}
}];

当我尝试访问classOne,classTwo,classThree和classFour中的任何列时,我得到一个异常由于未捕获异常'NSInternalInconsistencyException'终止应用程序,原因:密钥名称没有数据。在获取其值之前调用fetchIfNeeded。

解决方案

这是Parse.com本地数据存储功能中的一个错误适用于iOS。



从1.6.3发行说明:


改进本地一致性使用includeKey和NSNull值进行数据存储/解析查询。



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

解决方案

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

这篇关于指针数据不存储在本地数据库中,解析ios的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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