[英]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.