Difficulty posting Actions to Timeline

我的梦境 提交于 2019-11-29 15:48:55

I have the same problem and I changed the callback to be more helpful:

  var fb_url = '/me/YOUR_NAMESPACE?key=value';
  FB.api(fb_url,'post',
    function(response) {
      console.log(response);
      if (!response || response.error) {
        var msg = 'Error occured';
        if (response.error) {
          msg += "\n\nType: "+response.error.type+"\n\nMessage: "+response.error.message;
        }
        alert(msg);
      } else {
        alert('Post was successful! Action ID: ' + response.id);
      }
    }
  );

UPDATE

I finally got a post to the timeline, and the change I had to make was to use the BETA version of JavaScript SDK. ( https://developers.facebook.com/support/beta-tier/ )

Use this:

<script src="//connect.beta.facebook.net/en_US/all.js#appId=xxx&amp;xfbml=1"></script>

Instead of this:

<script src="//connect.facebook.net/en_US/all.js#appId=xxx&amp;xfbml=1"></script>

i had some difficultly posting initially as well. My problem lied the configuration settings of the action. Make sure that your actions are set to be for the exact object. Here are some screens of what I have set up and working:

If these settings are correct, check the error code that comes back from facebook, post it here and i can help you further.

Regarding the final point on og:url -- that's correct. You can generally consider the OG URL to be the "primary key" of an Object in the Graph.

jcaruso

To clear up some possible confusion, the og:url doesn't "HAVE" to be the same URL as the url of your object1.php page. The important thing to note is that regardless of the URL that you reference there, it has to have the META tags in the html &lt;head&gt; of the page.

I, for example, put the URL of a canvas page in there so that when someone clicks the hyperlink in the action on the timeline it opens that page. As long as the META information from the 'Get Code' link for the Object is in the head, you won't get the error.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!