Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if my IOS application is updated

I need to check when my app launches if it was being updated, because i need to make a view that only appears when the app is firstly installed to appear again after being updated.

like image 811
user2412870 Avatar asked Jun 03 '13 14:06

user2412870


People also ask

How do I know if my app is updated?

At the top right, tap the profile icon. Tap Manage apps & device. Apps with an update available are labeled "Update available."

How can you see when an app was last updated on iPhone?

Answer: A: Answer: A: In the App Store App, find the App in which you have interest - then tap on the Version History link from the relevant App page. Here you will find the release dates for each version.

How do I check my iOS app version?

iOS SettingsOpen the Settings app on your iOS device. Scroll down the settings list and locate your app. Tap on your app to select it. The App Settings Panel has multiple options including Location, Notifications, Shell Version, App Version, etc.

How do I force an iOS app to update?

Even Apple and Microsoft don't force security updates. You can always opt out or restore an older version. If its a security or feature requirement, you can tell your users the update is necessary, or the app will not function. You can block their credentials until they update, but it will still be their choice.


1 Answers

You could save a value (e.g. the current app version number) to NSUserDefaults and check it every time the user starts the app.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {     // ...      NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];      NSString *currentAppVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];     NSString *previousVersion = [defaults objectForKey:@"appVersion"];     if (!previousVersion) {         // first launch          // ...          [defaults setObject:currentAppVersion forKey:@"appVersion"];         [defaults synchronize];     } else if ([previousVersion isEqualToString:currentAppVersion]) {         // same version     } else {         // other version          // ...          [defaults setObject:currentAppVersion forKey:@"appVersion"];         [defaults synchronize];     }        return YES; } 

The swift-2 version looks like this:

let defaults = NSUserDefaults.standardUserDefaults()  let currentAppVersion = NSBundle.mainBundle().objectForInfoDictionaryKey("CFBundleShortVersionString") as! String let previousVersion = defaults.stringForKey("appVersion") if previousVersion == nil {     // first launch     defaults.setObject(currentAppVersion, forKey: "appVersion")     defaults.synchronize() } else if previousVersion == currentAppVersion {     // same version } else {     // other version     defaults.setObject(currentAppVersion, forKey: "appVersion")     defaults.synchronize() } 

The swift-3 version looks like this:

let defaults = UserDefaults.standard  let currentAppVersion = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as! String let previousVersion = defaults.string(forKey: "appVersion") if previousVersion == nil {     // first launch     defaults.set(currentAppVersion, forKey: "appVersion")     defaults.synchronize() } else if previousVersion == currentAppVersion {     // same version } else {     // other version     defaults.set(currentAppVersion, forKey: "appVersion")     defaults.synchronize() } 
like image 84
tilo Avatar answered Sep 29 '22 16:09

tilo