javascript Facebook - FB.UI 提要和共享对话框
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19957859/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Facebook - FB.UI feed and share dialog
提问by MrYannick
I have some trouble with the Facebook FB.UI - Feed and Sare dialog. I need to send the page of the website to a friend, im using the FB.UI Javascript API. According to the facebook documentation they said you have to use the "from and to" parameter. But when i use the "from and to" parameters it doesn't work. When i delete these parameters it works fine, but i cant post to a friends wall for sure.
我在 Facebook FB.UI - Feed 和 Sare 对话框中遇到了一些问题。我需要将网站页面发送给朋友,我使用 FB.UI Javascript API。根据facebook文档,他们说您必须使用“from and to”参数。但是当我使用“from and to”参数时它不起作用。当我删除这些参数时,它工作正常,但我肯定无法发布到朋友墙。
I've been looking for a while, and have try'd the following steps:
我一直在寻找一段时间,并尝试了以下步骤:
Does the user have enabled the right settings to post on his timeline (check)
Does the user have liked the facebook page (check)
Am i logged in (check)
用户是否启用了正确的设置以在他的时间线上发布(检查)
用户是否喜欢 Facebook 页面(检查)
我登录了吗(检查)
This is the link to the documentation: Feed and Share Dialogs
这是文档的链接:Feed and Share Dialogs
This is my code:
这是我的代码:
PS: I get the alert what is saying: "Post was published" but it doesn't show up on facebook.
PS:我收到警报说的是:“帖子已发布”,但它没有出现在 facebook 上。
function share()
{
FB.ui({
method: 'feed',
name: 'The name',
link: 'The URL',
from: '100001738814056',
to: '100003105898115',
caption: 'An example caption',
}, function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);
}
edit: I've got some more information about my problem, and i guess i found the problem.. If you take a look at this image you'll see a row with: "Feed" and one with "?api_key=". If im taking a look at the URL of feed i guess it misses the get api key, not sure if iam correct
编辑:我有一些关于我的问题的更多信息,我想我发现了问题.. 如果你看一下这张图片,你会看到一行:“Feed”和一个带有“?api_key=”的行。如果我查看提要的 URL,我猜它错过了 get api 密钥,不确定我是否正确
The image link
图片链接
回答by MrYannick
We'll after a day of searching.. i know the solution.
我们会经过一天的搜索......我知道解决方案。
If you create an app in Facebook, the mode of the app is " in sandbox mode ", when you turn the sandbox mode off you can post to facebook while tagging a friend!
如果您在 Facebook 中创建应用程序,该应用程序的模式是“沙盒模式”,当您关闭沙盒模式时,您可以在标记朋友的同时发布到 Facebook!
So my problem is solved.
所以我的问题解决了。