本文介绍了为什么 PFRelation 不支持 fromLocalDataStore 查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 PFUser 对象,其中有几个 PFRelation 指向其他对象.当我运行以下代码时:

I have a PFUser object with several PFRelation pointing to other objects. When I run the following code:

PFRelation *relation = [[PFUser currentUser] relationForKey:@"Relation"];
PFQuery *query = [relation query];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error){
    NSLog(@"%@", objects);
}];

它工作正常.但是,当我想从本地数据存储执行相同操作时:

it works fine. However, when I want to do the same from the local data store:

PFRelation *relation = [[PFUser currentUser] relationForKey:@"Relation"];
PFQuery *query = [[relation query] fromLocalDataStore]; // !!!
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error){
    NSLog(@"%@", objects);
}];

它什么都不返回,尽管我已经用 [myObject pinInBackground] 固定了我的用户和相关对象.

it returns nothing, despite the fact I've pinned both my user and related objects with [myObject pinInBackground].

为什么PFRelation 查询不支持fromLocalDataStore?我做错了什么?

Why PFRelation queries does not support fromLocalDataStore? What I'm doing wrong?

推荐答案

我创建了一个错误报告 对于这个问题是

I've created a bug report for this issue which is

上报给工程团队进行进一步调查

所以看起来这是一个错误

So it looks like it's a bug

与此同时,我已将所有 PFRelations 转换为指向相关 PFObject 的指针数组.不像 PFRelation 那样花哨,但适用于本地数据存储.

In the meanwhile, I've converted all my PFRelations to arrays of pointers to related PFObjects. Not as fancy as PFRelation, but works fine with local data storage.

更新:在 Parse SDK v 中解析解决了问题.1.7.3

Update: parse solved the issue in Parse SDK v.1.7.3

这篇关于为什么 PFRelation 不支持 fromLocalDataStore 查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-19 04:22