2014-03-14 69 views
3

我們使用的是restfb 1.6.14。在獲取公共帖子時出現以下錯誤。接收到類型爲OAuthException的Facebook錯誤響應:發生意外錯誤。請稍後重試您的請求。 (代碼2,子代碼null)

com.restfb.exception.FacebookOAuthException: Received Facebook error response of 
type OAuthException: An unexpected error has occurred. Please retry your reques 
t later. (code 2, subcode null) 
     at com.restfb.DefaultFacebookClient$DefaultGraphFacebookExceptionMapper. 
exceptionForTypeAndMessage(DefaultFacebookClient.java:964) 
     at com.restfb.DefaultFacebookClient.throwFacebookResponseStatusException 
IfNecessary(DefaultFacebookClient.java:885) 
     at com.restfb.DefaultFacebookClient.makeRequestAndProcessResponse(Defaul 
tFacebookClient.java:824) 
     at com.restfb.DefaultFacebookClient.makeRequest(DefaultFacebookClient.ja 
va:765) 
     at com.restfb.DefaultFacebookClient.makeRequest(DefaultFacebookClient.ja 
va:729) 
     at com.restfb.DefaultFacebookClient.fetchConnection(DefaultFacebookClien 
t.java:271) 
     at java.util.TimerThread.mainLoop(Timer.java:512) 
     at java.util.TimerThread.run(Timer.java:462) 

使用下面的代碼獲得訪問令牌,

AccessToken accessToken = new 
    DefaultFacebookClient().obtainAppAccessToken(appid,appsecret); 
    String token=accessToken.getAccessToken(); 

使用下面的源代碼獲得的公開信息,

public Connection<Post> publicSearchMessages(String keyword, int limit) { 
    Connection<Post> messages = fbClient.fetchConnection("search", 
      Post.class, Parameter.with("q", keyword), 
      Parameter.with("limit", limit), Parameter.with("type", "post")); 

    return messages; 
} 

爲什麼發生這個錯誤?我如何解決這個錯誤?

回答

0

使用Graph API 2.0,您不允許搜索帖子,甚至是公共帖子。

相關問題