0

Is it possible to programmatically check the bundle version of the previous app version installed? I know how to get the current version

[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];

The reason I ask is because there is a bug when updating my app from version A to C, but not B to C. I'd like to be able to check if the previous version was version A and if so, handle the bug accordingly.

Kevin_TA
  • 4,575
  • 13
  • 48
  • 77

1 Answers1

0

save the version in NSUserDefault

everytime app shutdown or after the checking of the version

NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];

[[NSUserDefaults standardUserDefaults] setObject:version  forKey:@"version"];

check it at the beginning of the app runs

NSString *newVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];

NSString *oldVersion =  [[NSUserDefaults standardUserDefaults] objectForKey:@"version"];

compare newVersion & oldVersion

adali
  • 5,977
  • 2
  • 33
  • 40
  • My problem is that version A has already been released in the App Store. I cannot change that binary anymore. So version A is never being saved to the defaults. You follow me? – Kevin_TA Apr 19 '13 at 18:35
  • so as far as i know, you can't know the previous version if you didn't log it :( – adali Apr 19 '13 at 18:37