我在facebook api上分享朋友墙上的图像时遇到问题。错误如下。
“message”:“(#240)需要指定有效用户(通过会话或通过API参数指定用户。”
我的代码是
String graphPath = null;
Bundle params = new Bundle();
params.putString("message", shortMsg.getText().toString());
TextView friendID = (TextView) shareToFriendDlg.findViewById(R.id.friendID_hiden_TextView);
params.putString("type", "photo");
params.putString("link",info.LINK);
params.putString("name",info.NAME);
params.putString("picture",info.PICTURE);
params.putString("caption",info.CAPTION);
params.putString("message", shortMsg.getText().toString());
params.putString("description", info.DESCRIPTION);
graphPath = friendID.getText().toString() + "/links";
mAsyncRunner.request(graphPath, params, "POST", new AsyncRequestListener() {
@Override
public void onComplete(JSONObject obj, Object state) {
Log.d("Sharing ", obj.toString());
Global.ApplicationActivity.runOnUiThread(new Runnable() {
public void run() {
shareToFriendDlg.dismiss();
Toast.makeText(Global.ApplicationActivity, "Shared :-)", Toast.LENGTH_LONG).show();
}
});
}
}, null);
答案 0 :(得分:0)
错误消息解释了自己,你需要与facebook有一个有效的会话来运行它,首先执行并创建一个有效的权限序列的有效facebook对象,然后你可以继续进行图像共享实现