ios - Facebook ios sdk共同好友

标签 ios facebook facebook-ios-sdk

我一直在上网,试图弄清楚如何获得两个用户的共同 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/

相关文章:

java - Android 中的 Facebook 好友生日

Facebook FQL 查询 Event_member "Inviter"和 "Inviter_type"

ios - Facebook auth.extendssoaccesstoken 错误代码 10

ios - 无法访问当前登录 Facebook 用户的相册 - Swift

ios - statusBarFrame.height 在横向时返回 1024.0 (iPad)

ios - iPhone X Safe Area Top Guide 延迟计算/错误对齐

ios - 涂上许多不同颜色的别针。 iOS。 swift 3.Xcode 9

ios - 带有 Wrap 的 SwiftUI HStack

javascript - 解析 XML 时出错,第 337 行,第 62 列 : The reference to entity "appId" must end with the ';' delimiter

iphone - iOS Facebook登录快速应用程序切换保持在Facebook App上