# 这是我登录后的代码,它不会在Facebook上发布照片 - #
public void onClickSelectContact(View btnSelectContact) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
Bitmap bitmap = screenShot(btnSelectContact);
System.out.println("man man "+bitmap.getHeight());
bitmap.compress(CompressFormat.JPEG, 0, bos);
image_array = bos.toByteArray();
System.out.println("man man "+image_array);
System.out.println("byte array:"+image_array.length);
facebook.authorize(ac, permissions, new DialogListener() {
public void onFacebookError(FacebookError e) {
// TODO Auto-generated method stub
}
public void onError(DialogError e) {
// TODO Auto-generated method stub
}
public void onComplete(Bundle values) {
// TODO Auto-generated method stub
Bundle params = new Bundle();
//params.putString("method", "photos.upload");
params.putByteArray("picture", image_array);
params.putString("message", "this myth man");
try {
facebook.request(("me") + "/photos", params, "POST");
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} public void onCancel() {
}});}
登录后
答案 0 :(得分:0)
在添加此权限 publish_actions 后尝试。 检查请求后你得到的json。在该检查中,哪个权限被拒绝。
{
"data": [
{
"permission": "public_profile",
"status": "granted"
},
{
"permission": "publish_actions",
"status": "granted"
},
{
"permission": "user_friends",
"status": "declined"
}
]
}
我猜问题是你被拒绝了一些被要求的权限。这可能是原因。 希望这有帮助。