Facebook对话框出现,但总是显示“发生错误”。

3
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">

...

<head>

...

<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
</head>
<body>
<div id="fb-root"></div>
<fb:like id="fb-like" href="http://www.example.com" layout="button_count" show_faces="false" width="100"></fb:like>

...

myscript.js:

FB.ui(
   {
     method: 'stream.publish',
     message: 'getting educated about Facebook Connect',
     attachment: {
       name: 'Connect',
       caption: 'The Facebook Connect JavaScript SDK',
       description: (
         'A small JavaScript library that allows you to harness ' +
         'the power of Facebook, bringing the user\'s identity, ' +
         'social graph and distribution power to your site.'
       ),
       href: 'http://github.com/facebook/connect-js'
     },
     action_links: [
       { text: 'Code', href: 'http://github.com/facebook/connect-js' }
     ],
     user_message_prompt: 'Share your thoughts about Connect'
   },
   function(response) {
     if (response && response.post_id) {
       alert('Post was published.');
     } else {
       alert('Post was not published.');
     }
   }
 );

我在我的网页上有一个Facebook的“喜欢”按钮,它能正常工作。
但是当我从我的JavaScript源代码中调用上面的FB.ui方法时,Facebook对话框弹出,但显示以下错误消息:
**An error occurred. Please try again later.**

自从我开始尝试实现它以来,这已经重复发生了两天。 错误信息并不是很有用。 有什么想法是什么导致了这个问题或如何缩小问题的范围?
3个回答

2

1

虽然它已经被弃用了,但问题在于您没有执行该操作的权限。确保您的FB.login调用请求publish_stream,就可以解决问题。

我遇到了一个问题,即网站登录请求了这个权限,但如果用户此时没有登录到网站,则会出现


0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接