1

使用此代码,我想提取我的朋友列表,下一步是我朋友的所有最后签到,但列表始终为空。

public void onClick(View v) {
            String fqlQuery = "SELECT uid,name,pic_square FROM user WHERE uid IN "
                    + "(SELECT uid2 FROM friend WHERE uid1 = me() LIMIT 25)";
            Bundle params = new Bundle();
            params.putString("q", fqlQuery);
            Session session = Session.getActiveSession();
            Request request = new Request(session, "/fql", params, HttpMethod.GET, new Request.Callback() {
                public void onCompleted(Response response) {
                    Log.i(TAG, "Result: " + response.toString());

                    try {
                        GraphObject graphObject = response.getGraphObject();
                        JSONObject jsonObject = graphObject.getInnerJSONObject();

                        Log.d("data", jsonObject.toString());
                        JSONArray array = jsonObject.getJSONArray("data");

                        System.out.println("länge array" + array.length());

                        for (int i = 0; i < array.length(); i++) { //

                            JSONObject friend = array.getJSONObject(i);

                            Log.d("uid", friend.getString("uid"));
                            Log.d("name", friend.getString("name"));

                        }
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                }
            });
            Request.executeBatchAsync(request);
        }
    });
    return view;
}

}

我也想得到我朋友的所有签到,但数据是空的,如果有人可以帮助我,我会很高兴

LogCat 的输出:

{ "data": []}
4

1 回答 1

2

从 Facebook API v2.0 开始,好友列表(/me/friends 和 FQL 等效项)返回使用您的应用程序的用户好友。此限制也适用于处于 v1.0 模式的应用程序。

如果您希望通过标记操作来结交朋友:https ://developers.facebook.com/docs/graph-api/reference/v2.0/user/taggable_friends

如果您想通过邀请来邀请朋友参加游戏:https ://developers.facebook.com/docs/graph-api/reference/v2.0/user/invitable_friends

干杯!

于 2014-06-03T15:38:19.867 回答