2013-04-01 66 views
0

Hy夥計們,我嘗試通過貝沃方法獲取記錄的用戶和其他用戶之間的共同朋友,但我得到了空數據節點,雖然錯誤是null。有關這個問題的任何幫助。得到Facebook中的共同朋友API Android應用程序

private void getMutualFriends() { 
     Bundle params = new Bundle(); 
     params.putString("fields", "id,name,picture"); 
     getFriendsIds().put("100005132166273", ""); 
     RequestBatch requestBatch = new RequestBatch(); 
     for (final String friendId : getFriendsIds().keySet()) { 
      requestBatch.add(new Request(Session.getActiveSession(), "/me/mutualfriends/" + friendId, params, HttpMethod.GET, new Request.Callback() { 
       public void onCompleted(Response response) { 
        Log.i("Result: " , response.toString()); 
        GraphObject graphObject = response.getGraphObject(); 
        if (graphObject != null) { 
         if (graphObject.getProperty("id") != null) { 
         } 
        } 
       } 
      })); 
     } 
     requestBatch.executeAsync(); 
    } 

我總是有這種反應{Response: responseCode: 200, graphObject: GraphObject{graphObjectClass=GraphObject, state={"data":[]}}, error: null, isFromCache:false}.

我這個也"new Request(Session.getActiveSession(), "me/mutualfriends/" + friendId, null, HttpMethod.GET, new Request.Callback().......

更換請求創建,並得到了同樣的答覆。

我會執行約1000次的方法,所以我用Facebook的請求批次,如果你知道更好的方法讓我知道請。

回答

0

我知道我可能在這裏有點天真,但也許你檢查的用戶沒有共同的朋友?

您是否熟悉「Graph API」資源管理器?這是非常有用的: https://developers.facebook.com/tools/explorer/

試着粘貼你的網址(記得用你正在檢查的用戶替換'friendsId'),看看你得到了什麼。

+0

你是對的兩個測試用戶沒有共同的朋友:( –

相關問題