Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/121.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用MvvmCross在Xamarin iOS/Android的splashscreen中登录_Android_Ios_Xamarin_Mvvmcross - Fatal编程技术网

使用MvvmCross在Xamarin iOS/Android的splashscreen中登录

使用MvvmCross在Xamarin iOS/Android的splashscreen中登录,android,ios,xamarin,mvvmcross,Android,Ios,Xamarin,Mvvmcross,当我的Xamarin应用程序启动时,我尝试根据一些存储的凭据自动登录用户 登录正常,但在启动过程中,闪屏会消失一两秒钟,显示为黑屏 当我禁用自动登录功能时,初始屏幕将平滑地转移到下一个视图 代码如下: public async void Start(object hint = null) { _secureStorageService = Mvx.Resolve<ISecureStorageService>(); ClearParam

当我的Xamarin应用程序启动时,我尝试根据一些存储的凭据自动登录用户

登录正常,但在启动过程中,闪屏会消失一两秒钟,显示为黑屏

当我禁用自动登录功能时,初始屏幕将平滑地转移到下一个视图

代码如下:

    public async void Start(object hint = null)
    {
        _secureStorageService = Mvx.Resolve<ISecureStorageService>();

        ClearParameterCacheUponStart();
        SetPushTokenRequirement();


        var loginService = Mvx.Resolve<ILoginService>();

        var stopwatch = Stopwatch.StartNew();
        Debug.WriteLine("Start loginService");
        if (HasUsernameAndPassword() && await loginService.TryLoginWithStoredCredentials())
        {
            ShowViewModel<DashboardViewModel>();
        }
        else
        {
            ShowViewModel<LoginViewModel>(true);
        }

        stopwatch.Stop();
        Debug.WriteLine("Finished loginService: {0}ms", stopwatch.ElapsedMilliseconds);
    }
公共异步无效启动(对象提示=null)
{
_secureStorageService=Mvx.Resolve();
ClearParameterCacheUponStart();
SetPushTokenRequirement();
var loginService=Mvx.Resolve();
var stopwatch=stopwatch.StartNew();
Debug.WriteLine(“启动登录服务”);
if(hasUserName和Password()&等待loginService.TryLoginWithStoredCredentials())
{
ShowViewModel();
}
其他的
{
ShowViewModel(真实);
}
秒表;
WriteLine(“完成的登录服务:{0}ms”,stopwatch.elapsedmillesons);
}
这是登录用户的正确位置吗?或者对于这个Xamarin MvvmCross项目有更好的解决方案吗


提前谢谢。

我在我的应用程序中也做了类似的事情。但是,我没有与服务器通信,而是将令牌存储在持久存储中并检查它是否存在。我通常反对使用闪屏,所以我所做的是模仿我将要显示的布局,在应用程序准备就绪之前,不在其中添加任何内容。不管怎样,也许可以添加你在SplashScreen中使用的代码,看起来怎么样?谢谢@Cheesebaron,我会查看它并让你知道