2
我想要得到的invitable朋友的完整列表,我使用此代碼的Android的Facebook朋友invitable請求不與極限參數工作
GraphRequest request2 = new GraphRequest(tokenObj,"/me/invitable_friends?limit=5000",null, HttpMethod.GET, new GraphRequest.Callback() {
@Override
public void onCompleted(GraphResponse graphResponse) {
try {
JSONObject graphObject = graphResponse.getJSONObject();
JSONArray dataArray = graphObject.getJSONArray("data");
for (int i = 0; i < dataArray.length(); i++) {
try {
// here all that you want
JSONObject object = dataArray.getJSONObject(i);
// get facebook user id,name and picture
String str_id = object.getString("id");
String str_name = object.getString("name");
JSONObject picture_obj = object.getJSONObject("picture");
JSONObject data_obj = picture_obj.getJSONObject("data");
String str_url = data_obj.getString("url");
} catch (Exception e) {
e.printStackTrace();
}
}
} catch (Exception e) {
System.out.println("Exception=" + e);
e.printStackTrace();
}
}
});
request2.executeAsync();
當我運行這個它給了我一個OAuthException (安必須使用主動訪問令牌來查詢有關當前用戶的信息)。 有趣的是,當我刪除限制參數,併發送只/我/ invitable_friends調用的作品,但給了我一個默認的25分數據對象的結果。我需要從開始的數據對象中的所有結果,所以我需要極限參數。任何想法,我可以使它工作?