2012-07-19 34 views
1

我想要使用Graph API获取所有在线朋友的列表。如何使用Graph API在iPhone上获取Facebook好友在线状态?

我使用以下..

[facebook requestWithGraphPath:@"me/friends?fields=id,name,online_presence" andDelegate:self]; 

,但是这给了我0的结果。

谢谢。

编辑:

我已经从FB这样的权限。

+0

这是不是一个有效的图形调用 – 2012-07-19 08:45:59

+0

@PauldeLange你能帮我吗..?我不知道这个图表的工作原理是什么...... P – 2012-07-19 08:47:00

+0

你有没有使用Google? [这](http://qpleple.com/fetch-online-friends-list-with-facebook-graph-api/)似乎是唯一可用的方式 – 2012-07-19 08:49:50

回答

2

如果您有friends_online_presence权限配置正确,试试这个:

NSString* method = @"fql.query"; 
NSString* fql = @"SELECT uid, online_presence FROM user WHERE uid IN (SELECT uid2 FROM friend where uid1 = me())"; 
NSDictionary* params = [NSDictionary dictionaryWithObject: fql forKey: @"query"]; 

[[self facebook] requestWithMethodName: method 
          andParams: [params mutableCopy] 
         andHttpMethod: @"GET" 
          andDelegate: delegate]; 

这将返回你的朋友列表以及在线状态:活动,空闲,脱机或错误。

+0

这个作品很棒....我将探索更多.. :) – 2012-07-19 09:12:25

相关问题