Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to determine if my app was updated

I have an IOS app, and each time it is updated I want to do some house cleaning. What is the best way to determine if an IOS app has been updated?

like image 664
Chris Kooken Avatar asked Dec 10 '22 02:12

Chris Kooken


1 Answers

The simplest way may be to get the current version, compare the version to a saved version (if there is one), perform clean up if necessary, save the new version. Here are examples on retrieving and storing version info for comparison.

//Getting the application version
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]

//Retrieving the saved application version
NSString *savedVersion = [[NSUserDefaults standardUserDefaults] stringForKey:@"versionkey"];

//Saving the version
[[NSUserDefaults standardUserDefaults] setObject:version forKey:@"versionkey"];

And if you are wondering how to compare versions here is an example using the NSNumericSearch compare option: http://spitzkoff.com/craig/?p=148

like image 64
Joe Avatar answered Feb 02 '23 07:02

Joe