这是关于 facebook 开放图的一个非常新手的问题。我完成了教程,使用新动词和新名词创建新命名空间没有问题。但是,我无法让一个简单的 LIKE OBJECT 工作......
无论如何,这是我所做的一切的结果。
当我尝试使用 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>