我正在为我的 Facebook 画布游戏应用程序之一使用 JavaScript sdk。我正在尝试实现自定义故事共享对话框以在用户墙上发布故事。
开发者网站上可用的信息不明确且有限。下面的代码用于使用开放的 Grap API 共享自定义故事。波纹管代码可在提供的 Facebook 开发人员站点链接 ( https://developers.facebook.com/docs/sharing/reference/share-dialog ) 上找到。Facebook 提供的代码在使用预定义的 action_type 时运行良好。
FB.ui({
method: 'share_open_graph',
action_type: 'og.likes',
action_properties: JSON.stringify({
object:'https://developers.facebook.com/docs/',
})
}, function(response){});
我在 FB Developer 控制台应用程序的 Open Graph 选项卡上为自定义故事创建了一个对象(板球)和动作(播放)。我创建了一个名为 cricket.html 的自托管对象(html 页面)。下面是内容或我的 html 页面。我验证了 Open Graph Object Debugger 上的 html 页面。Graph Object Debugger 向我展示了所有信息,我给出的信息没有错误或警告。
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta property="fb:app_id" content="*************" />
<meta property="og:type" content="appnamespace:cricket" />
<meta property="og:title" content="App for u" />
<meta property="og:url" content="https://example.com/appnamespace/cricket.html" />
<meta property="og:description" content="Find me on facebook for u" />
<meta property="og:image" content="https://example.com/appnamespace/image/any_time_share.png" />
</head>
<body>
</body>
</html>
Bellow 是我要替换的代码:- og.likes ---to--->appnamespace:play("play" 是我的操作)。
我在这里做错什么了吗?请告诉我。
function customshare()
{
FB.ui({
method: 'share_open_graph',
action_type: 'appnamespace:play',
action_properties: JSON.stringify(
{
object:'https://example.com/appnamespace/cricket.html',
})
},
function(response){});
}
但是,在执行 FB.ui 方法时出现以下错误:自定义共享的“share_open_graph”。