我正在使用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();
}
}
}
}