ios - 通过连接表解析查找

标签 ios objective-c parse-platform

我正在使用 Parse 并拥有以下实体..

User
----
fullName

Follow
----
follower (User)
followee (User)

我想根据以下条件查找用户

  1. 给定一些文本,他们的名字就包含该文本。
  2. 存在一条关注记录,其中他们是关注者,当前用户是关注者

我目前正在尝试这样的事情......

PFQuery *followQuery = [Follow query];
[followQuery whereKey:@"followee" equalTo:[PFUser currentUser]];

PFQuery *userQuery = [PFUser query];
[userQuery whereKey:@"fullName" containsString:theSearchText];

[userQuery whereKey:@"somethingHereButNotSureWhat" matchesQuery:followQuery];

有没有一种方法可以让我缺少它?无论我在 key 中输入什么,我似乎都无法使查询正常工作。我需要输入 self. 或其他内容,但我没有尝试过。

最佳答案

如何在Follow 类上使用matchesQuery:

PFQuery *userQuery = [PFUser query];
[userQuery whereKey:@"fullName" containsString:@"SEARCHTEXTHERE"];

PFQuery *followQuery = [PFQuery queryWithClassName:@"Follow"];
[followQuery whereKey:@"followee" equalTo:[PFUser currentUser]];
[followQuery whereKey:@"follow" matchesQuery:userQuery];

关于ios - 通过连接表解析查找,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26342163/

相关文章:

ios - 微软的iOS桥IslandWood是如何实现的?

swift - 查询中的查询不附加 Swift/Parse

Xcode 7.1 与 iOS 9.1 错误 : include of non-modular header inside framework module 'Parse.PFGeoPoint'

jquery - Phonegap IOS 的 Phonegap 推送通知 - 推荐解决方案

ios - build设置和临时包过程中的 PROVISIONING PROFILE 有什么区别?

ios - 无法运行 flutter 。抛出 "couldn' t find package fluttery :"error

ios - 嵌入在其他 View 中的 UITableView 的节标题位置错误

ios - Facebook 测试推送通知 "Device token does not match the environment"

objective-c - 设置 NSToolbarItem 未选中

java - 解析,带来所有结果