iosdevnyc
iosdevnyc

Reputation: 1871

Get Previous app version after app update ios

Does anyone know of a way to get the previous app version after app update? We actually missed to store that information somewhere and I need to get the previous app version somehow. I am not sure if it is in possible, any help would be appreciated. thank you

Upvotes: 0

Views: 193

Answers (1)

AliSoftware
AliSoftware

Reputation: 32681

That is not possible because once the new application has been installed, any trace of the previous application binary is replaced by the new binary.

So the only way to do this is to store the current version in a key of your NSUserDefaults:

  • At each launch check if the key stored in the NSUserDefaults is different from the current version
  • If it is different, the app just has been updated and the previous version is the value for the NSUserDefaults key. In that case after retrieving it, replace the old version value with the current version in the NSUserDefaults for the next launches.

(The current version of the application can be obtained using [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"] for example)

But as far as you didn't store the information in your NSUserDefaults in your previous version, it is not possible to check that if you didn't implement this kind of system yourself.

Upvotes: 3

Related Questions