我正在实现 iPhone 应用程序,我想从 Facebook 获取已在其设备上安装该应用程序的 friend 列表。
为此,我发送如下请求:
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
我怎样才能收到所有正在使用应用程序的 friend 的如下回复?
{
"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";
}
我怎样才能做到这一点?
最佳答案
使用 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];
关于iPhone 应用程序 : find the Facebook friends who has installed app into their device,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10717285/