2011-09-23 52 views
1

信息試圖當:OAuthException /有源訪問令牌必須用於查詢當前用戶

facebook requestWithGraphPath:@"me/friends" 

在我的iOS應用程序出現錯誤

"OAuthException/An active access token must be used to query information about the current user" 

我可以查詢我自己的Facebook數據成功USNG requestWithGraphPath:@「我」,我可以使用令牌我必須從

https://graph.facebook.com/me/friends?access_token=xxxx

獲取數據

在瀏覽器中。但它不會在iOS應用程序...

任何人都可以幫忙嗎?我嘗試重新創建一個新的Fb應用程序,因爲我從我的批准的應用程序中刪除了我的初始測試應用程序,我認爲這可能導致了它,但結果是相同的。我在我的權限中請求「脫機訪問」,因此令牌不應過期。

編輯:有趣的是查詢FQL用戶表返回我的朋友列表ID

+0

什麼是isSessionValid函數返回給您? – Ahmed

回答

1

儘管這是一個老的文章,但我回答它的追隨者:

當你發佈與Facebook圖形API的東西,你必須獲得atleat「publish_stream」的權限另外,請確保在您收到授權後發佈到牆上,例如

if (![SharedFacebook isSessionValid]) 
{ 
    NSArray *permissions = [[NSArray alloc] initWithObjects:@"offline_access", @"publish_stream", nil]; 
    [SharedFacebook authorize:permissions];///Show the login dialog 

    /// [self postToWall];///Do not call it here b/c the permissions are not granted yet and you are posting to the wall. 
    } 
else 
{   
    [self postToWall]; 
} 
相關問題