Uploading photos to Facebook: Adding parameters before executing the newUploadPhotoRequest call gives the 'OAuthException' error

[亡魂溺海] 提交于 2019-12-04 10:14:38

When you create an newUploadPhotoRequest, that method will implicitly add some parameters to the Request object that's returned. When you call setParameter, you're replacing those implicit parameters with your own, which causes the request to be missing some required params.

What you should do instead is:

Request request = Request.newUploadPhotoRequest(Session.getActiveSession(), BitmapFactory.decodeResource(_context.getResources(), R.drawable.default_image), uploadPhotoRequestCallback);
Bundle parameters = request.getParameters(); // <-- THIS IS IMPORTANT
parameters.putString(...);
// add more params here
request.setParameters(parameters);
request.executeAsync();
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!