Alert When New Version of iOS App Is Available

How to alert user of new update of iOS app

Don't worry there is no code required. I've recently updated my app and I was wondering the same thing. It should do it automatically once the new version is on the store. A small red icon will appear in the top right of the App Store app icon. ;)

Alert when new version of iOS app is available

iVersion sounds like the exact thing you are looking for. It works similar to Sparkle on Mac OSX where it consults a remote file on your website where you can bump the version number once Apple approves your app and shows a prompt to the user if their version is lower than the one specified on your server.

Is it possible to send update notification to app users iOS

Code for App Version Comparision is:

 func checkAppUpdateAvailability(onSuccess: @escaping (Bool) -> Void, onError: @escaping (Bool) -> Void) {
guard let info = Bundle.main.infoDictionary,
let curentVersion = info["CFBundleShortVersionString"] as? String,
let url = URL(string: "http://itunes.apple.com/lookup?bundleId=com.facebook.app") else {
return onError(true)
}
do {
let data = try Data(contentsOf: url)
guard let json = try JSONSerialization.jsonObject(with: data, options: [.allowFragments]) as? [String: Any] else {
return onError(true)
}
if let result = (json["results"] as? [Any])?.first as? [String: Any], let appStoreVersion = result["version"] as? String {
print("version in app store", appStoreVersion," current Version ",curentVersion);
let versionCompare = curentVersion.compare(appStoreVersion, options: .numeric)
if versionCompare == .orderedSame {
onSuccess(false)
} else if versionCompare == .orderedAscending {
onSuccess(true)
// 2.0.0 to 3.0.0 is ascending order, so ask user to update
}
}
} catch {
onError(true)
}
}

Now you can check App Update.

checkAppUpdateAvailability { (status) in
//When status == true show popup.
} onError: { (status) in
// Handle error
}


Related Topics



Leave a reply



Submit