Xamarin 表单:新版本可用时 AppStore 应用程序页面未打开?

Xamarin forms: AppStore app page is not opening when new version is available?

我正在使用 Plugin.LatestVersion NuGet 包来检查新版本的可用性。

我的代码:

using Plugin.LatestVersion;

var isLatest = await CrossLatestVersion.Current.IsUsingLatestVersion();

if (!isLatest)
{
    var update = await DisplayAlert("New Version", "There is a new version of this app available. Would you like to update now?", "Yes", "No");

    if (update)
    {
        await CrossLatestVersion.Current.OpenAppInStore();
    }
}

在 android 和 IOS 中,如果有新版本可用,显示警报效果很好。 对于 android 应用程序,如果从警报中点击“是”,它将在 Play 商店应用程序中加载应用程序页面。

但对于 ios,当从警报中点击是选项时,应用程序页面未加载。 Cannot connect to AppStore 出现在 Appstore 应用中。

截图:

我也试过 await CrossLatestVersion.Current.OpenAppInStore("app bundle name");,但在 AppStore 上显示的屏幕与上面相同。

这是一个已知问题,已在此处报告:https://github.com/edsnider/latestversionplugin/issues/6

所以我暂时使用 Launcher.OpenAsync 在 AppStore 中打开应用程序。

public async void IsLatestVersion()
{
    var isLatest = await CrossLatestVersion.Current.IsUsingLatestVersion();

    if (!isLatest)
    {
        var update = await DisplayAlert("New Version", "There is a new version of this app available. Would you like to update now?", "Yes", "No");

        if (update)
        {
            if(Device.RuntimePlatform == TargetPlatform.iOS.ToString())
            {
                await Launcher.OpenAsync(new Uri("App store link"));
            }
            else
            {
                await CrossLatestVersion.Current.OpenAppInStore();
            }
        }
    }
}