【问题标题】:Performance improvement of Xamarin forms applicationXamarin 表单应用程序的性能改进
【发布时间】:2022-05-21 16:35:21
【问题描述】:

我正在开发一个 Xamarin 表单(Android 和 iOS)应用程序,并在应用程序启动时检查登录状态,如果用户已经登录到应用程序,则分配适当的值。这个过程需要 6 秒来加载我们应用程序的第一页。我已按照 Xamarin Auth 存储用户登录时的凭据。

以下是存储和检索我在应用程序中使用的登录用户详细信息的过程。

https://developer.xamarin.com/recipes/cross-platform/xamarin-forms/general/store-credentials/

App.cs文件的OnStart方法中使用的代码sn-p:

        protected async override void OnStart()
        {
            LoginType login = DependencyService.Get<ILoginCredentialStorage>().LoginExists();
            this.MainPage = new NavigationPage(new HomePage(login));
        }

如何减少在应用程序中加载第一页的时间?

【问题讨论】:

    标签: c# performance xamarin.ios xamarin.forms xamarin.android


    【解决方案1】:

    您可能需要将登录凭据的获取移至登录页面,并尽可能晚地保留它(即 OnAppearing 而不是构造函数),以便您可以显示进度指示器。

    Here are some more tips

    【讨论】:

      猜你喜欢
      • 2021-09-16
      • 2012-06-17
      • 2021-01-04
      • 2016-03-23
      • 1970-01-01
      • 1970-01-01
      • 2022-01-12
      • 2018-03-08
      • 1970-01-01
      相关资源
      最近更新 更多