繁体   English   中英

Unity Facebook SDK FB.Login无法正常运行

[英]Unity Facebook SDK FB.Login not functioning properly

当从canvas Facebook Web应用程序中的统一Facebook插件(我尝试过4.2.4和4.3.3)调用FB.Login时,当用户在Facebook对话框提示您接受时单击“取消”时,永远不会调用回调函数应用程序的权限。

初始化工作正常,SDK加载,然后我用Facebook委托调用FB.Login,如果用户取消,则没有回调。 如果将其构建为Web应用程序并在指向它的Facebook应用程序中创建它,则可以在sdk中提供的示例中看到此行为。

有什么建议么? 我需要该回调来继续我的应用程序流程。

谢谢。

造成此问题的原因是,当用户拒绝向应用程序授予访问权限时,AbstractFacebook只会忽略从Facebook API接收到的整个FBResult参数,包括“ cancelled”参数。

从AbstractFacebook反编译的OnAuthResponse方法如下所示:

protected void OnAuthResponse(FBResult result)
{
    Dictionary<string, object> dictionary = new Dictionary<string, object>();
    dictionary["is_logged_in"] = (object) (bool) (this.IsLoggedIn ? 1 : 0);
    dictionary["user_id"] = (object) this.UserId;
    dictionary["access_token"] = (object) this.AccessToken;
    dictionary["access_token_expires_at"] = (object) this.AccessTokenExpiresAt;

    FBResult result1 = new FBResult(Json.Serialize((object) dictionary), result.Error);
    using (List<FacebookDelegate>.Enumerator enumerator = this.authDelegates.GetEnumerator())
    {
        while (enumerator.MoveNext())
        {
            FacebookDelegate current = enumerator.Current;
            if (current != null)
            current(result1);
        }
    }
    this.authDelegates.Clear();
}

如果可以某种方式覆盖此行为,则可以从存储在result.message中的JSON中删除“已取消”参数形式。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM