PFQuery whereKey doesNotMatchKey inQuery

时间:2018-02-15 12:11:17

标签: objective-c xcode parse-platform pfquery

我有2个这样的表:

-  Posts
    -  objectId (default objectId)
    -  content (text)
-  Comments
    -  objectId (default objectId)
    -  post (pointer to Posts)
    -  text (text)

我一直试图抓住没有评论的帖子。

这是我到目前为止所尝试的内容:

PFQuery *query_comments     =   [PFQuery commentQuery];
[query_comments whereKeyExists:@"post"];
[query_comments selectKeys:@[@"post"]];

PFQuery *query_posts        =   [PFQuery postsQuery];
[query_posts whereKey:@"objectId" doesNotMatchKey:@"post" inQuery:query_comments];
[query_posts findObjectsInBackgroundWithBlock:^(NSArray * _Nullable objects, NSError * _Nullable error) {

    printf("\n\n");
    // objects should now contain all Posts that don't have comments

}];

修改

目前,query_posts会忽略query_comments,只是像正常一样提取帖子(就好像query_comments不存在一样)。

0 个答案:

没有答案