【问题标题】:iPhone app: find the Facebook friends who has installed app into their deviceiPhone 应用程序:查找已将应用程序安装到设备中的 Facebook 好友
【发布时间】:2012-05-23 09:39:43
【问题描述】:

我正在实施 iPhone 应用程序,我想从 Facebook 获取已将应用程序安装到其设备中的朋友列表。

为此,我发送如下请求:

  AppDelegate *appDelegate=[[UIApplication sharedApplication] delegate];
   NSMutableDictionary*params = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"picture,id,name,link,gender,last_name,first_name",@"fields", nil];
   [[appDelegate facebook] requestWithMethodName:@"friends.getAppUsers" andParams:params andHttpMethod:@"GET" andDelegate:self];

但作为回应,它只给了我在他们的设备中安装了应用程序的用户的 Facebook id:

   xxxxxxxxxxxxxx1,
   xxxxxxxxxxxxxx2,
   xxxxxxxxxxxxxx3

我怎样才能收到所有正在使用应用程序的朋友的如下回复?

  {
    "first_name" = abc;
    gender = male;
    id = 10000xxxxxxxxxxxx;
    "last_name" = xyz;
    link = "http://www.facebook.com/profile.php?id=10000xxxxxxxxxxxx";
    name = "abc xyz";
    picture = "http://profile.ak.fbcdn.net/static-ak/rsrc.php/v2/yo/r/UlIqmHJn-SK.gif";         
 }

我怎样才能做到这一点?

【问题讨论】:

    标签: iphone objective-c ios facebook facebook-graph-api


    【解决方案1】:

    使用 FQL,我可以在查询中使用参数 is_app_use 得到响应

      NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                    @"select uid, name,pic_small, is_app_user from user where uid in (select uid2 from friend where uid1=me()) and is_app_user=1", @"query",
                                    nil];
    [[APPDELEGATE facebook ]   requestWithMethodName: @"fql.query"
                                           andParams: params
                                       andHttpMethod: @"POST"
                                         andDelegate: self];
    

    【讨论】:

      猜你喜欢
      • 2011-03-15
      • 1970-01-01
      • 2011-06-04
      • 2013-10-18
      • 2019-10-30
      • 2013-09-11
      • 1970-01-01
      • 2011-02-21
      • 1970-01-01
      相关资源
      最近更新 更多