Facebook 图形 API Stream.publish 中的问题

发布于 2024-10-22 02:10:53 字数 1024 浏览 0 评论 0原文

我正在使用 Graph API 并使用stream.publish,它以前工作正常,但现在当我在 js 文件中分离 JS 时,我将 CANVAS URL 作为参数传递给 javascript 函数,以下是我的代码:

function feedPublish(message,image,canvasURL){
var attachment = {'media':[{'type':'image','src':image,'href':canvasURL}]};
var action_links= [{ 'text':"Music Mood", 'href': canvasURL }];
message="I am in mood of "+message;
FB.ui({'method':'stream.publish','message':message,
        'attachment':attachment,
        'action_links':action_links
    },
    function(response){

    }
);  
 }


function publishMessage(message,canvasURL){
   var emo_id='id_'+$('emoction').val();
   var emo_image=$('#'+emo_id+' img.emoction_image').attr('src');
   feedPublish(message,emo_image,canvasURL);
 }

然后从我调用的 html函数在单击此处发布消息:

publishMessage('Gimme More (The Legendary Ms. Britney Spears)','http://apps.facebook.com/musicmood'); return false;

并在屏幕截图中出现以下错误在此处输入图像描述

所以我无法了解问题,知道问题是什么或者我该如何解决它?

I am using Graph API and using stream.publish, it was previously working fine but now when I separate JS in a js file then I am passing CANVAS URL as an argument to javascript function, following is my code:

function feedPublish(message,image,canvasURL){
var attachment = {'media':[{'type':'image','src':image,'href':canvasURL}]};
var action_links= [{ 'text':"Music Mood", 'href': canvasURL }];
message="I am in mood of "+message;
FB.ui({'method':'stream.publish','message':message,
        'attachment':attachment,
        'action_links':action_links
    },
    function(response){

    }
);  
 }


function publishMessage(message,canvasURL){
   var emo_id='id_'+$('emoction').val();
   var emo_image=$('#'+emo_id+' img.emoction_image').attr('src');
   feedPublish(message,emo_image,canvasURL);
 }

then from html I am calling function publish Message on click here:

publishMessage('Gimme More (The Legendary Ms. Britney Spears)','http://apps.facebook.com/musicmood'); return false;

And getting the following error that is in screenshotenter image description here:

So I am unable to understand problem, any idea that what's the problem or how can I fix that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

郁金香雨 2024-10-29 02:10:53

您正在使用旧方法发布“stream.publish”,请使用图形 API 中包含的“feed”方法
有关更多详细信息,请访问此 http://developers.facebook.com/docs/reference /javascript/fb.ui/

You are using old method for publishing "stream.publish" please use "feed" method which is included in Graph API
For more details visit this http://developers.facebook.com/docs/reference/javascript/fb.ui/

风吹短裙飘 2024-10-29 02:10:53

Facebook

请注意:我们正在弃用 REST API,因此如果
您正在构建一个新的应用程序,您不应该使用此功能。
而是使用 Graph API 并将 Post 对象发布到 feed
User对象的连接

我建议您使用图形 api 并使用相同的参数向 /me/feed 发送 POST 请求 它会起作用的。

Facebook says:

Please note: We are in the process of deprecating the REST API, so if
you are building a new application you shouldn't use this function.
Instead use the Graph API and POST a Post object to the feed
connection of the User object

I would advice you to use the graph api and send a POST request to /me/feed with same parameters. It will work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文