Anyway to make an update wipe out old NSuserdefaults?

Discussion in 'iOS Programming' started by nottooshabby, Oct 22, 2008.

  1. nottooshabby macrumors 6502

    Jul 12, 2008
    My app saves the numbers people enter in fields in the NSUserdefaults for when they exit and return to the program. My next update is fairly significant and some of the fields have been moved around to different views. I'm concerned that reading in user defaults from version 1.0 will cause some initial flakey behavior. Is there anyway to have an update do a "clean" install? Is there a setting in the info.plist or something? Basically I want the app to be deleted and then installed to remove all the old data.
  2. firewood macrumors 604

    Jul 29, 2003
    Silicon Valley
    Add a version number to your new user defaults. If you don't find the new version number in your user defaults on launch, assume they're old defaults, and wipe them.
  3. chbeer macrumors member


    Sep 22, 2008
    ...or better update them as good as possible. The most important thing is the user experience. Do you think the user would like you to wipe out all of his work?
  4. nottooshabby thread starter macrumors 6502

    Jul 12, 2008
    I totally agree if I had a database or any significant amount of data that had to be remembered. My app remembers numbers in testfields so if you get a call and come back into the app 5 minutes later all the fields are just filled out. Most likely if you come back to the app after even a day you'll be entering in a whole new set of numbers anyways.

Share This Page