问题描述
我有一个 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);
}];
它没有返回任何内容,尽管事实上我用<$ c固定了我的用户和相关对象$ c> [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
In与此同时,我已将所有 PFRelations 转换为指向相关 PFObject
的指针数组。不像 PFRelation
那样花哨,但适用于本地数据存储。
In the meanwhile, I've converted all my PFRelations
to arrays of pointers to related PFObject
s. 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查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!