使用Facebook流发布 [英] using facebook stream publish

查看:143
本文介绍了使用Facebook流发布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想发布一个URL作为朋友墙的附件:

I want to publish a URL as an attachment to a friends wall:

var attachment={'name':'favor','href':'http://128.196.239.71/movie.php?mid=<?php echo  $_GET['mid']; ?>'};
                                         Facebook.streamPublish('',attachment,null,friends[i],comment,callback);

上述给我一个Facebook未定义,我该怎么办来弥补这个问题?

Doing the above gives me a Facebook undefined, what should I do to remedy this?

为了这样做,我需要设置一个特殊的权限?

Do I need to set a special permission in order to do this to the sender of this message?

推荐答案

您需要使用stream.publish权限才能使用stream.publish方法或等效图形API调用。

You do need the stream.publish permission in order to use the stream.publish method or the equivalent graph API call.

您可以检查用户已经通过以下方式授予此权限:

You can check that the user has already granted this permission with something like this:

FB.getLoginStatus(function(response) { if (response.perms) { /* check perms */ } })

您可以通过以下方式请求许可: / p>

You can request the permission with something like this:

FB.login(function(response) { /* check perms */ }, {scope: 'publish_stream'})

然后在响应中,您可以检查是否实际授予,那么您应该可以做流发布电话。

Then in the response you can check to see if it was actually granted, then you should be able to do stream publish calls.

但是,我没有牛逼认识你的电话Facebook.streamPublish的格式。我认为新的API要求您更加像

However, I don't recognize the format of your call "Facebook.streamPublish". I think the new API requires you to do a call more like

FB.api({method: 'stream.publish', message: 'hello'}, function(response) {})

除此之外,你可以使用对话框API创建一个帖子并将其显示给用户,并让他们批准或不批准它。这不需要stream.publish权限。这样(FB.ui API文档中给出的示例):

Alternatively to all this, you can use the dialogs API to create a post and show it to the user, and have them approve it or disapprove it. This does not require the stream.publish permission. Something like this (the example given in the FB.ui API docs):

 FB.ui(
   {
     method: 'feed',
     name: 'Facebook Dialogs',
     link: 'http://developers.facebook.com/docs/reference/dialogs/',
     picture: 'http://fbrell.com/f8.jpg',
     caption: 'Reference Documentation',
     description: 'Dialogs provide a simple, consistent interface for applications to interface with users.',
     message: 'Facebook Dialogs are easy!'
   },
   function(response) {
     if (response && response.post_id) {
       alert('Post was published.');
     } else {
       alert('Post was not published.');
     }
   }
 );

按照Facebook的变化,我希望在阅读之后,这些信息仍然准确无误(甚至准确开始)。

At the rate Facebook changes, I hope some of this information is still accurate by the time you read it (or even accurate to begin with).

这篇关于使用Facebook流发布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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