1

我正在尝试使用 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显示弹出窗口以询问用户权限时,什么也没有发生;没有弹出。

4

1 回答 1

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;
}
于 2009-11-17T09:45:48.587 回答