iPhone应用程序:找到已将应用程序安装到其设备中的Facebook好友

时间:2012-05-23 09:39:44

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

我正在实施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];

但作为回应,它仅向我提供已将app安装到其设备中的用户的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";         
 }

我怎样才能做到这一点?

1 个答案:

答案 0 :(得分:1)

使用FQL我可以在Query

中获得参数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];