2011-04-15 46 views
1

我正在嘗試在牆上發佈一些東西。我使用這個代碼,由OnClickListener稱爲按鈕爲什麼我的android facebook sdk給出

public void postOnWall(String msg) { 
     mFacebook.authorize(this,new String[] {"publish_stream", "read_stream", "offline_access"}, 
       new DialogListener() { 
         public void onError(DialogError e) { 
         } 
         public void onFacebookError(FacebookError e) { 
         } 
         public void onCancel() { 
         } 
         public void onComplete(Bundle values) { 
         } 
      } 
     ); 

     Log.d("Tests", "Testing graph API wall post"); 
     try { 
       Bundle parameters = new Bundle(); 
       parameters.putString("message", msg); 
       parameters.putString("description", "test test test"); 
       String response = mFacebook.request("me/feed", parameters, 
         "POST"); 
       Log.d("Tests", "got response: " + response); 
       if (response == null || response.equals("") || 
         response.equals("false")) { 
        Log.v("Error", "Blank response"); 
       } 
     } catch(Exception e) { 
      e.printStackTrace(); 
     } 
    } 

的響應字符串然而讀取

{「錯誤」的:{「類型」:「OAuthException」,「消息」:「活動接入令牌必須用於查詢有關當前用戶的信息。「}}

此外,應該請求權限的對話從不停留。它開始加載,但隨後消失。

回答

0

看起來好像你沒有正確認證用戶。

我不確定你是否遺漏了那部分代碼,或者你根本沒有這樣做,但我會看看example provided with the API

+0

好吧,是不是SSO應該這樣做?所以我不應該在我的應用程序中進行身份驗證。 – vasion 2011-04-15 15:32:22

相關問題