温馨提示:本文翻译自stackoverflow.com,查看原文请点击:xamarin.forms - Xamarin forms: AppStore app page is not opening when new version is available?
app-store google-play xamarin.forms

xamarin.forms - Xamarin形式:新版本可用时,AppStore应用程序页面无法打开吗?

发布于 2020-04-09 11:45:42

我正在使用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上显示相同的屏幕。

查看更多

提问者
Sreejith Sree
被浏览
73
Sreejith Sree 2020-02-04 17:31

这是一个已知问题,请在此处报告: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();
            }
        }
    }
}