2012-07-19 78 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

相關問題