我正在使用Parse并拥有以下实体..
User
----
fullName
和
Follow
----
follower (User)
followee (User)
我想按照以下标准对Users
进行查找。
Follow
记录,其中follower
,当前用户为followee
。我目前正在尝试这样的事情......
PFQuery *followQuery = [Follow query];
[followQuery whereKey:@"followee" equalTo:[PFUser currentUser]];
PFQuery *userQuery = [PFUser query];
[userQuery whereKey:@"fullName" containsString:theSearchText];
[userQuery whereKey:@"somethingHereButNotSureWhat" matchesQuery:followQuery];
有没有办法让我的工作让我失踪?我似乎无法让查询工作在我放入密钥的任何地方。我需要放self
或.
或其他东西,但我尝试过的东西都没有。
答案 0 :(得分:1)
如何在matchesQuery
课程上使用Follow
:
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];
答案 1 :(得分:0)
我认为这样的事情会起作用:
PFQuery *followQuery = [PFQuery queryWithClassName:@"Follow"];
[followQuery whereKey:@"followee" equalTo:[PFUser currentUser]];
PFQuery *userQuery = [PFQuery queryWithClassName:@"_User"];
[userQuery whereKey:@"fullName" containsString:@"SEARCHTEXTHERE"];
[userQuery whereKey:@"USERKEYHERE" matchesKey:followQuery inQuery:followQuery];
希望这有帮助!