發佈到Facebook好友牆時發生錯誤我想使用WebDialog.FeedDialogBuilder使用facebook Android sdk發佈到我的好友牆。使用WebDialog.FeedDialogBuilder在android
這裏是我的代碼:
Bundle params = new Bundle();
params.putString("name", "Facebook SDK for Android");
params.putString("caption", "Build great social apps and get more installs.");
params.putString("description", "The Facebook SDK for Android makes it easier and faster to develop Facebook integrated Android apps.");
params.putString("link", "https://developers.facebook.com/android");
params.putString("picture", "https://raw.github.com/fbsamples/ios-3.x-howtos/master/Images/iossdk_logo.png");
params.putString("to", friend_uid);
WebDialog feedDialog = (new WebDialog.FeedDialogBuilder(this, mCurrentSession, params))
.setOnCompleteListener(new OnCompleteListener() {
@Override
public void onComplete(Bundle values, FacebookException error) {
if (error == null) {
// When the story is posted, echo the success
// and the post Id.
final String postId = values.getString("post_id");
if (postId != null) {
Toast.makeText(activity,
"Posted story, id: "+postId,
Toast.LENGTH_SHORT).show();
} else {
// User clicked the Cancel button
Toast.makeText(activity,
"Publish cancelled",
Toast.LENGTH_SHORT).show();
}
} else if (error instanceof FacebookOperationCanceledException) {
// User clicked the "x" button
Toast.makeText(activity,
"Publish cancelled",
Toast.LENGTH_SHORT).show();
} else {
// Generic, ex: network error
Toast.makeText(activity,
"Error posting story",
Toast.LENGTH_SHORT).show();
}
}
}).build();
feedDialog.show();
當我刪除從我上面的代碼下面一條線,我可以成功發佈在我的時間表。
params.putString("to", friend_uid);
但是,當我保留此行張貼到我的朋友時間線我收到對話框,消息
"Cannot Post to User's Wall Error" with Ok Button
我相信我已經拿到了需要的permissions.I有也打印在我的日誌
我的會話權限是
{Session state:OPENED, token:{AccessToken token:ACCESS_TOKEN_REMOVED permissions:[photo_upload, publish_stream, video_upload, installed, publish_checkins, publish_actions, share_item, user_friends, email, user_photos, public_profile, status_update, create_note, basic_info]}, appId:xxxxx402xxxx}
我已經在SO和Google中搜索了很多,但沒有找到任何解決方案。 我需要爲我的應用程序提供任何其他設置嗎? 請建議我解決這個問題。
感謝