I am using Plugin.LatestVersion NuGet package for checking new version availability.
My Code:
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();
}
}
In android and IOS, displaying an alert is working fine if a new version is available. In the case of the android app, if tap yes from the alert it will load the app page in the play store app.
But for ios, the app page is not loading when tap yes option form the alert. Cannot connect to AppStore
is showing on the Appstore app.
Screenshot:
I have also tried await CrossLatestVersion.Current.OpenAppInStore("app bundle name");
, but showing the same above screen on AppStore.
It's a known issue, reported here: https://github.com/edsnider/latestversionplugin/issues/6.
So I used Launcher.OpenAsync
for opening the app in AppStore for now.
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();
}
}
}
}