docs
docs copied to clipboard
为应用内社交增加代码示例
在工单里面碰到过三次问: 我想查出来 A 关注的且同样关注 A 的粉丝,应该怎么查? 最近一次在 2476 工单中,上两次在老的工单中。 所以建议把这个问题的答案直接写到文档里面。
以下是以 Obj-C 为示例的答案:
NSString *userId = @"xxxxxxxxxxxxxxxxxx";
// 先找出A的粉丝
AVQuery *followerQuery= [AVUser followerQuery:userId];
// 找出A关注的人
AVQuery *followeeQuery= [AVUser followeeQuery:userId];
// 找出A关注的人,且这些人是A的粉丝
[followeeQuery whereKey:@"followee" matchesKey:@"follower" inQuery:followerQuery];
[followerQuery findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
}];