这是我的代码:
window.fbAsyncInit = function() {
console.log('FB.init');
FB.init({
appId : 'xxxxxxxxxxxxxxx',
status: true,
xfbml: true,
cookie: true,
oauth: true,
version: 'v2.5'
});
};
(function(d, s, id)
{ var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/pl_PL/sdk.js#xfbml=1&version=v2.5";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
function fbLogin() {
console.log('FB.getLoginStatus');
FB.getLoginStatus(function(response)
{ console.log('response: ' + response);
console.log('status: ' + response.status);
if (response.status == 'connected')
{ accessToken = response.authResponse.accessToken; }
else
{ FB.login(function(response)
{ if (response.status == 'connected')
{ accessToken = response.authResponse.accessToken; }
else { alert("Bye!"); }
}, {scope:'publish_stream,user_photos,friends_photos,user_photo_video_tags,friends_photo_video_tags'});
}
});
}
function fbFeedShare()
{ console.log('fbFeedShare');
fbLogin();
console.log('FB.api POST');
FB.api("/me", "POST", { body: "body", message: 'My message is ...' },
function(response)
{ console.log('response: ' + response);
console.log('status: ' + response.status);
if (response.hasOwnProperty("error"))
console.log('error: ' + response.error.message);
if (!response || response.error) { console.log("POST ERROR"); }
else { console.log("POST OK"); }
});
}
现在,当我在控制台日志中调用 fbFeedShare 时,每个看起来都很好:
FB.init
fbFeedShare
FB.getLoginStatus
response: [object Object]
status: connected
FB.api POST
response: [object Object]
status: undefined
POST OK
但在Facebook上没有明显的结果
有什么问题?