Question

Is this the case? Do NSUserDefaults get reset when you submit an update to an app on the App Store, or are they reset?

My app is crashing when updated but not crashing when downloaded fully - so I'm trying to determine what could possibly be different in the updated session to the freshly downloaded session.

Cheers, Nick.

Was it helpful?

Solution

They are usually not reset unless the user deletes the app. For basic data, NSUserDefaults is the best way to save data such as preferences, dates, strings etc. If you are looking to save images and files, the file system is a better bet.

OTHER TIPS

I beleive the answer is YES, it will persist. This also fully documented under the Application Directory chapter in the Apple iPhone OS Programming Guide.

  1. Direct answer to the posted question: YES.
  2. Your problem: Your app gets crashed due to logic issues. Suppose you store an object in defaults and the app checks it's value on launch (or elsewhere). In you update you could change the way it is checked or used, e.g. you expect a value, but the object is nil, or vice versa. This may cause a SIGABRT or EXC_BAD_ACCESS.

If you had CoreData model and you changed something in your model and update, without managing migration, thats probably reason why your app crashes on update...

I have a similar experience. Our app stores a version number in Settings.Bundle/Root.Plist. This gets displayed through the iPhone Settings app. What we find is that on an Install the version number gets loaded from the app bundle - therefore the version number is correct. On an update however the version number doesn't change. This gives the impression the user is running a previous version of the app. We don't have any logic linked to the version number, it's just for display (it could be used by contact centre staff when diagnosing faults).

Our experience is NSUserDefaults doesn't get cleared when a user updates our app, but the Settings display doesn't get updated either.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top