Facebook自定义故事共享使用JavaScript sdk()显示错误(Action需要至少一个参考) [英] Facebook custom story share using JavaScript sdk() showing error(Action Requires At Least One Reference)

本文介绍了Facebook自定义故事共享使用JavaScript sdk()显示错误(Action需要至少一个参考)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JavaScript sdk作为我的一个Facebook画布游戏应用程序。我正在尝试实现自定义故事分享对话框以在用户墙上发布故事。

I am using JavaScript sdk for one of my Facebook canvas game application. I am trying to implement custom story share dialog to post story on user wall.

开发者网站上提供的信息不清楚且有限。下面的代码用于分享自定义故事使用open grap API。 Bellow代码可在Facebook开发者网站链接上找到( https://developers.facebook的.com /文档/共享/参考/共享对话框)。 Facebook提供的代码工作正常,因为它使用预定义的action_type。

The information available on developer site is unclear and limited.The bellow code is for sharing custom story using open grap API. Bellow code is available on Facebook developer site link provided(https://developers.facebook.com/docs/sharing/reference/share-dialog). The Facebook provided code is working fine as its using predefined 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 console App上为自定义故事创建了一个对象(板球)和动作(播放) Open Graph tab.i创建了一个名为cricket.html的自托管Object(html页面).Bellow是内容或我的html page.i验证了Open Graph Object Debugger.Graph Object Debugger上的html页面向我展示了所有的信息,是什么我没有给出任何错误或警告。

I have create an object(cricket) and action(play) for custom story on FB Developer console App's Open Graph tab.i have created a self hosted Object(html page) called cricket.html.Bellow is the content or my html page.i verified the html page on Open Graph Object Debugger.Graph Object Debugger showing me all the information, what i have given with no errors or warnings .

<!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>

贝娄是我要替换的代码: -
og.likes --- to ---> appnamespace:play(play是我的动作)。

Bellow is my code where I am replacing:- og.likes ---to--->appnamespace:play("play"is my action).

我在这里做错了吗?请告诉我。

Is i am doing any thing wrong here ? please let me know.

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'用于自定义共享。

However i am getting the below error while executing the FB.ui method: 'share_open_graph' for custom share.

推荐答案

我通过简单的改变解决了我的问题: -

I got my problem solved by simple changing this:-

object:'https://example.com/appnamespace/cricket.html',

cricket:'https://example.com/appnamespace/cricket.html',

这篇关于Facebook自定义故事共享使用JavaScript sdk()显示错误(Action需要至少一个参考)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆