Code to check if there is a new version on AppStore.
This code is a version based on @anupgupta-arg's code.
And is tested in a separated repository called Check Version App.
You can force the update by calling
CheckUpdate.shared.showUpdate(withConfirmation: false)
Or the user can choose if they want to update now or later by calling
CheckUpdate.shared.showUpdate(withConfirmation: true)
But, if you want to check if there is a new TestFlight version to update, you can try:
CheckUpdate.shared.showUpdate(withConfirmation: true, isTestFlight: true)
Inside the code has a link from iTunes. There, you should pay attention and put the country where the application is available.
Like this: http://itunes.apple.com/<country>/lookup?bundleId=\(identifier)
For example:
let url = URL(string: "http://itunes.apple.com/br/lookup?bundleId=\(identifier)")
if the application is available in BrazilAnd, in this documentation we can use:
"https://api.appstoreconnect.apple.com/v1/apps/\(identifier)/builds"
But, we need to generate a JWT Token first.
To learn how to generate an acceptable token, you should use this documentation.
CheckUpdate.shared.showUpdate(withConfirmation: true)
CheckUpdate.shared.showUpdate(withConfirmation: false)