在Xamarin上关闭登录模式时出现WindowManagerBadTokenException错误

时间:2016-06-27 19:11:00

标签: c# xamarin xamarin.android xamarin.forms xamarin.auth

我正在使用Xamarin,我正在尝试使用For x = 4 to 3918 if (x,2) contains the letters "LW" then look at (x,1) highlight all rows with value = (x,1) green 登录,这是正确的,但是当我的日志成功并且我必须关闭模式时,我收到此错误:

  

未处理的例外情况:   Android.Views.WindowManagerBadTokenException:无法添加窗口 - 令牌android.os.BinderProxy@a60f6df无效;你的活动在运行吗?

这是我在登录成功时使用的代码:

Xamarin.Auth

这是关闭模式的auth.Completed += (sender, eventArgs) => { if (eventArgs.IsAuthenticated) { App.SaveToken(eventArgs.Account.Properties["access_token"]); App.SuccessfulLoginAction.Invoke(); } else { // The user cancelled } } 中的代码:

app.cs

知道我为什么会收到这个错误吗?

1 个答案:

答案 0 :(得分:0)

我找到了解决方案,而不是现在,我找到了去年, 如果有人有o会有同样的问题,吼你可以找到解决方案, 原因是因为有些东西我收到错误,应用程序无法处理,那么你只需要在这种情况下添加 try ,就像下面的代码一样。

     try
        {
            auth.Completed += domplete_facebook;
        }
        catch (Exception e)
        {
            Console.WriteLine(e);
            throw;
        }

希望这有助于某人, 问候