这是关于facebook开放图的一个非常新手的问题。我做了教程,没有问题用新动词和新名词创建新的命名空间。但是,我无法让一个简单的对象工作......
无论如何,这是我正在做的一切的结果。
当我尝试执行与facebook的开放图形一样的自定义内置时,我收到以下错误:
Object
error: Object
code: 1611072
message: "The action you're trying to publish is invalid because it does not specify any reference objects. At least one of the following properties must be specified: object."
type: "Exception"
__proto__: Object
__proto__: Object
这是我的代码:
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"
xmlns:fb="https://www.facebook.com/2008/fbml">
<head>
<title>OG Tutorial App</title>
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# object: http://ogp.me/ns/object#">
<meta property="fb:app_id" content="99999999999" />
<meta property="og:type" content="object" />
<meta property="og:url" content="http://jl.com/" />
<meta property="og:title" content="Sample Object" />
<meta property="og:image" content="https://s-static.ak.fbcdn.net/images/devsite/attachment_blank.png" />
</head>
<body>
<div id="fb-root"></div>
<script type="text/javascript">
function postbake()
{
FB.api(
'/me/og.likes',
'post',
{ recipe: 'http://jl.com/' },
function(response) {
if (!response || response.error) {
alert('Error occured');
console.log(response);
} else {
alert('bake was successful! Action ID: ' + response.id);
}
});
}
</script>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '999999999999', // App ID
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
};
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
</script>
<fb:login-button show-faces="true" width="200" max-rows="1" scope="publish_actions">
</fb:login-button>
<input type="button" onclick="postbake()" value="like it" />
</body>
</html>
答案 0 :(得分:4)
消息:“您尝试发布的操作无效,因为它未指定任何引用对象。必须至少指定以下属性之一:object。”
您尝试将对象发布为recipe
,但参数名称必须为object
而不是......