iOS上的SignInWithCredentialAsync导致System.AggregateException

时间:2018-02-13 14:50:12

标签: ios firebase unity3d

我正在使用Firebase Unity SDK对FB和Google进行身份验证。

在iOS上尝试时,FB工作正常,但每当我使用Google登录时,它都会首次运行,但是当我重新启动应用程序并尝试再次使用Google登录时,会导致内部Firebase错误。

这是我得到的打印输出:

SignInWithCredentialAsync encountered an error: System.AggregateException: Exception of type 'System.AggregateException' was thrown.
-----------------

Encountered a FirebaseException:An internal error has occurred, print and inspect the error details for more information.
Valley.DatabaseHandler:<RequestLogin>m__0(Task`1)
System.Threading.Tasks.<ContinueWith>c__AnonStorey0:<>m__0(Task)
System.Threading.Tasks.<ContinueWith>c__AnonStorey2:<>m__0(Task)
System.Threading.Tasks.<ContinueWith>c__AnonStorey1:<>m__0()
System.Threading.Tasks.Task:<immediateExecutor>m__1(Action)
System.Threading.Tasks.Task`1:RunContinuations()
System.Threading.Tasks.Task`1:TrySetException(AggregateException)
System.Threading.Tasks.TaskCompletionSource`1:SetException(Exception)
Firebase.Auth.<GetTask>c__AnonStorey0:<>m__0()
Firebase.Auth.Future_User:SWIG_CompletionDispatcher(Int32)
Firebase.AppUtil:PollCallbacks()
Firebase.Platform.FirebaseMonoBehaviour:Update()

我的RequestLogin()函数如下所示:

public void RequestLogin(string id, string token, bool useId)
{
    Credential credential;
    if (useId)
    {
        credential = GoogleAuthProvider.GetCredential(id, token);
    }
    else
    {
        credential = FacebookAuthProvider.GetCredential(token);
    }

    if (credential != null)
    {
        auth.SignInWithCredentialAsync(credential).ContinueWith(task =>
        {
            if (task.IsCanceled)
            {
                Debug.LogError("SignInWithCredentialAsync was canceled.");
                return;
            }

            if (task.IsFaulted)
            {
                AggregateException ex = task.Exception as AggregateException;
                if (ex != null)
                {
                    FirebaseException fbEx = null;
                    foreach (Exception e in ex.InnerExceptions)
                    {
                        fbEx = e as FirebaseException;
                        if (fbEx != null)
                        {
                            Debug.LogError("Encountered a FirebaseException:" + fbEx.Message);
                            fbEx = null;
                        }
                    }
                }
                return;
            }

            if (task.IsCompleted)
            {
                FirebaseUser newUser = task.Result;
                Debug.LogFormat("User signed in successfully: {0} ({1})",
                    newUser.DisplayName, newUser.UserId);
                _user = auth.CurrentUser;
                _gameController.ActivateScene(GameController.Scene.GAME);
            }
        });
    }
}

正如您所看到的,我没有在例外中找到任何更多细节。

任何人都知道如何解决这个问题?为什么它只发生在第二次发布和之后,而不是第一次登录谷歌?

非常感谢任何帮助!

编辑:

有时我也会得到可能相关的内容:

System.ObjectDisposedException: The object was used after being disposed.
  at System.Net.Sockets.Socket.get_Available () [0x00000] in <filename unknown>:0 
  at System.Net.Sockets.NetworkStream.BeginWrite (System.Byte[] buffer, Int32 offset, Int32 size, System.AsyncCallback callback, System.Object state) [0x00000] in <filename unknown>:0 
  at Mono.Security.Protocol.Tls.RecordProtocol.SendAlert (Mono.Security.Protocol.Tls.Alert alert) [0x00000] in <filename unknown>:0 
  at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0 

0 个答案:

没有答案
相关问题