newMeRequest的onCompleted方法用户始终为null

时间:2014-06-22 19:36:37

标签: android facebook

当我使用Facebook Android SDK制作newMeRequest时

Request.newMeRequest(session, new Request.GraphUserCallback() {
    @Override
        public void onCompleted(GraphUser user, Response response) {
            if (user != null) {
                Log.e(TAG, "Logged in..." + user.getName());
            } else {
                Log.e(TAG, "Logged in... but user==null");
            }
         }
     }).executeAsync();

Logcat说“已登录..但用户== null”

我该怎么办?

1 个答案:

答案 0 :(得分:0)

也许您可以添加具有特定字段的参数:

Request request = Request.newMeRequest(currentSession, new Request.GraphUserCallback() {
    ....
}

Bundle parameters = new Bundle();
// REQUEST_FIELDS : id,name,email   
parameters.putString(FIELDS, REQUEST_FIELDS);
request.setParameters(parameters);
Request.executeBatchAsync(request);