我正在尝试使用iframe(而不是fbml)构建一个Facebook应用程序。我正在使用php客户端。 在尝试了很多之后我无法发布流也是我无法创建弹出窗口来询问用户是否有扩展权限。我使用了以下内容:
function facebook_prompt_permission(permission)
{
ensure_init(function()
{
//check is user already granted for this permission or not
FB.Facebook.apiClient.users_hasAppPermission(permission,
function(result) {
// prompt offline permission
if (result == 0)
{
alert(result);
// render the permission dialog
FB.Connect.showPermissionDialog(permission,function(result)
{
if (result == null)
alert('no permissons granted');
else
alert('permissions ' + result);
},true,null);
}
else
{
// permission already granted.
alert("permission already granted");
}
});
});
}
facebook_prompt_permission('publish_stream');
检查权限的响应为0,但是当我尝试FB.Connect.showPermissionDialog
显示弹出以询问用户是否允许时,没有任何反应;没有弹出。
答案 0 :(得分:1)
/* Need to check this user has the permissions to post to wall etc....*/
if (!$facebook->api_client->users_hasAppPermission("publish_stream")) {
// Redirect for permissions
$url = "http://www.facebook.com/connect/prompt_permissions.php?api_key=$apikey&v=1.0&ext_perm=publish_stream&next=[YOURAPPURL]";
header("Location: $url");
exit;
}