【发布时间】:2014-10-29 14:08:29
【问题描述】:
这是一个非常新手的问题,我无法找到解决方案,我花了很多时间阅读他们的官方文档,但这一切都是徒劳的,所以我作为最后的手段来到这里。
我想做什么
我想在我的时间线上发布我的自定义故事,
1)我创建了一个自定义故事
2)尝试通过共享对话框共享它[无效],并且也尝试了 api 调用。
<div id="fb-root"></div>
<!-- facebook code starts here -->
<script>
function statusChangeCallback(response) {
console.log('statusChangeCallback');
console.log(response);
function checkLoginState() {
FB.getLoginStatus(function(response) {
statusChangeCallback(response);
});
}
window.fbAsyncInit = function() {
FB.init({
appId : xxxxx[correctly used app id],
cookie : true, // enable cookies to allow the server to access
status : true,
xfbml : true, // parse social plugins on this page
version : 'v2.0' // use version 2.0
});
FB.getLoginStatus(function(response) {
statusChangeCallback(response);
});
FB.api(
'me/objects/restaurant.restaurant',
'post',
{
app_id: xxxxx[correctly used app id],
type: "restaurant.restaurant",
url: "http://samples.ogp.me/440002909390231",
title: "Sample Restaurant",
image:"https://static.ak.fbcdn.net/images/devsite/attachment_blank.png",
description: "This place rocks",
contact_info: "http://www.facebook.com",
location: "-122.148283"
},
function(response) {
// handle the response
}
);
FB.api(
'me/testxdev:eat',
'post',
{
restaurant: "http://samples.ogp.me/440002909390231"
},
function(response) {
// handle the response
}
);
};//********END OF FUNCTION ENCLOSING INIT()***********
// Load the SDK asynchronously
(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/en_US/sdk/debug.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<div class="fb-like" data-send="true" data-width="450" data-show-faces="true"></div>
<!-- End of facebook code-->
【问题讨论】:
标签: javascript facebook facebook-graph-api facebook-javascript-sdk