function fb_publish(){
var content = document.getElementsByTagName("textarea")[0].value;
var picture_path = "http://202.xxx.xxx.xx/snsPublish/img/Chrysanthemum.jpg";
FB.getLoginStatus(function (response){
if(response.status === 'connected'){
FB.api('me/feed', 'post',
{
message: content,
picture: picture_path, // picture
link: app_link
}, function(response){
if (!response || response.error) {
alert('실패! ' + response.status + ' You may logout once and try again');
} else {
alert('성공! Post ID: ' + response);
}
});
alert("발행되었습니다");
} else if (response.status === 'not_authorized') {
FB.login(function(){}, {scope : 'publish_actions'});
} else {
FB.login(function() {}, {scope: 'publish_actions'});
}
});
}
picture없이 message만 보낼 경우 정상작동하는데 picture부분 삽입하면 게시글 올리는게 실패하네요
response.status는 undefined로 나옵니다..