我一直在上网,试图弄清楚如何获得两个用户的共同 friend 的用户列表:
例如:
- 用户 1:我
- 用户 2:莱昂内尔·梅西
- 用户 2 和用户 1 是 friend
我需要使用 iOS Facebook SDK 与这两个用户成为好友的用户列表。
最佳答案
根据您的编辑,我认为您正在寻找这个:
1) 进行查询以获取好友列表和该好友列表中的所有 UID(假设您将其放入数组 self.friendList
)
2) 在该列表上运行 for 循环。
3) 将其提供给 FQL 查询:
for (NSString * friendID in self.friendList){
NSString * query = [NSString stringWithFormat:@"SELECT uid1, uid2 FROM friend where uid1= %@ and uid2 in (SELECT uid2 FROM friend where uid1=me())", friendID];
NSDictionary *queryParam = @{ @"q": query };
// Make the API request that uses FQL
[FBRequestConnection startWithGraphPath:@"/fql"
parameters:queryParam
HTTPMethod:@"GET"
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error) {
if (error) {
NSLog(@"Error: %@", [error localizedDescription]);
} else {
NSLog(@"Result: %@", result);
}
}];
}
(来自:https://developers.facebook.com/docs/ios/run-fql-queries-ios-sdk/)
4) 结果将是你和那个人之间的共同 friend 。
(如果您想获得所有 friend 的共同 friend ,您显然可以使用您想要的任何 friendID 来完成。)
关于ios - Facebook ios sdk共同好友,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19199671/