Facebook Android SDK为封面图片提供错误结果

Facebook Android SDK为封面图片提供错误结果,android,facebook,facebook-graph-api,Android,Facebook,Facebook Graph Api,我正在开发一个应用程序,使用Facebook进行用户登录。这个过程成功地完成了,但当我向Facebook询问用户信息(有相应的权限)时,我得到了除了他的封面照片以外的一切。我总是得到一个“FACEBOOK\u NON\u JSON\u RESULT”和一个错误代码为200的JFIF图像,而不是带有图像URL的JSON对象的预期响应,如下所示: [{Response: responseCode: 200, graphObject: GraphObject{graphObjectClass=Gra

我正在开发一个应用程序,使用Facebook进行用户登录。这个过程成功地完成了,但当我向Facebook询问用户信息(有相应的权限)时,我得到了除了他的封面照片以外的一切。我总是得到一个“FACEBOOK\u NON\u JSON\u RESULT”和一个错误代码为200的JFIF图像,而不是带有图像URL的JSON对象的预期响应,如下所示:

[{Response:  responseCode: 200, graphObject: GraphObject{graphObjectClass=GraphObject, state={"FACEBOOK_NON_JSON_RESULT":"����\u0000\u0010JFIF\u0000\u0001\u0002\u0000\u0000\u0001\u0000\u0001\u0000\u0000��\u0000\u0004*\u0000��\u0002\u001cICC_PROFILE\u0000\u0001\u0001\u0000\u0000\u0002"}}, error: null, isFromCache:false}]
new SetUserFacebookImage().execute(new String[] {getFacebookUserURL(mUser.getFace_book_id())});
我在Facebook开发者页面的Graph API Explorer上测试了该应用的访问令牌,它在那里工作。这个问题只发生在设备上,所以我不知道问题出在哪里

我最近更改了应用程序的权限。然而,直到今天,这个应用程序在新的权限下一直运行得很好,响应突然变成了JFIF图像。如果有人能给我任何关于这个问题的指示或解决方案,我将非常感激

编辑:以下是源代码的一部分:

public void getImage(String image_id, int width, int height)
{

    Session session = Session.getActiveSession();

    // Get request parameters
    Bundle requestParams = new Bundle();
    requestParams.putString("access_token", session.getAccessToken());
    requestParams.putBoolean("redirect", false);
    requestParams.putInt("width", width);
    requestParams.putInt("height", height);

    // Request URL
    String requestURL = "/" + image_id + "/picture";

    Request request = new Request(session, requestURL, requestParams, HttpMethod.GET, callback);

    Response response = request.executeAndWait();
    if (response.getError() == null)
    {
        setResponseJSON(response.getGraphObject().getInnerJSONObject());
    }
}

下面是一个异步类,用于获取用户facebook。你唯一需要的就是Facebook用户id

私有类SetUserFacebookImage扩展异步任务{

    private ProgressDialog progressDialog;

    @Override
    protected void onPreExecute() {
        progressDialog = new ProgressDialog(getActivity());
        progressDialog.setMessage("Retrieving Facebook profile image...");
        progressDialog.setIndeterminate(true);
        progressDialog.setCancelable(false);
        progressDialog.show();
    }

    @Override
    protected Bitmap doInBackground(String... params) {
        String urlStr = params[0];
        Bitmap img = null;

        HttpClient client = new DefaultHttpClient();
        HttpGet request = new HttpGet(urlStr);
        HttpResponse response;
        try {
            response = (HttpResponse)client.execute(request);           
            HttpEntity entity = response.getEntity();
            BufferedHttpEntity bufferedEntity = new BufferedHttpEntity(entity);
            InputStream inputStream = bufferedEntity.getContent();
            img = BitmapFactory.decodeStream(inputStream);       
        } catch (MalformedURLException e) {
            Log.e(FRAGMENT_NAME, "INVALID URL");
            e.printStackTrace();
        } catch (IOException e) {
            Log.e(FRAGMENT_NAME, "UNABLE TO PARSE FACEBOOK IMAGE");
            e.printStackTrace();
        }       

        return img;
    }

    protected void onPostExecute(Bitmap bitmap) {
        progressDialog.dismiss();

        if(bitmap != null) {
            mUserProfileImageView.setImageBitmap(bitmap);
            mUser.setProfile_picture(mImageAdapter.encodeBitmap(bitmap));
        } else
            mUserProfileInterface.relayUserValidationError(
                    getResources().getString(R.string.facebook_unable_to_get_user_profile));
    }
}
您可以这样调用该任务:

[{Response:  responseCode: 200, graphObject: GraphObject{graphObjectClass=GraphObject, state={"FACEBOOK_NON_JSON_RESULT":"����\u0000\u0010JFIF\u0000\u0001\u0002\u0000\u0000\u0001\u0000\u0001\u0000\u0000��\u0000\u0004*\u0000��\u0002\u001cICC_PROFILE\u0000\u0001\u0001\u0000\u0000\u0002"}}, error: null, isFromCache:false}]
new SetUserFacebookImage().execute(new String[] {getFacebookUserURL(mUser.getFace_book_id())});

你正在使用哪个facebook sdk?facebook Android 3.0。我会检查是否有更新。已更新到sdk 3.0.2,但问题仍然存在。你可以输入一些代码,以便我们也可以调试它添加源代码…希望有帮助