Fatso
Fatso

Reputation: 1318

How do I deal with preferences when I update my app?

When I do an update of my app, some people complain the preferences fail. How can I 'reset' the preferences when the user launches an update for the first time?

Upvotes: 1

Views: 117

Answers (2)

Alex Zielenski
Alex Zielenski

Reputation: 3601

Although I don't think this is good practice: You can keep a key in your preferences containing the app version it was used with and check this key each app launch. If the key's number is lower than your current application's number, call [NSUserDefaults resetStandardUserDefaults]

Upvotes: 1

John Haager
John Haager

Reputation: 2115

One method would be to include a preference that indicates the version of the app that last updated the preferences. Then, when your updated applications is first run, it can check that preference value, see that it is older, and perform whatever updates to the existing preferences are necessary.

Upvotes: 1

Related Questions