[英]Facebook ios sdk mutual friends
我一直在网上搜索,试图弄清楚如何获得两个用户的共同朋友的用户列表:
例如:
我需要使用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)结果将是您和那个人之间的共同朋友。
(这就是如果您想获得所有朋友的共同朋友,显然可以使用任何想要的friendID来完成。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.