iOS Development: How can I make changes to my app so that it only affects new users?
I'd like to make some drastic changes to my iOS app, but I don't want those changes to affect existing installs, since it may cause existing users to complain. How can I limit the new functionality to new installs only?
On开发者_运维知识库e easy way would be to set a global flag at a point in the code that only occurs before the user completes the tutorial, then if that flag is set, use the new code. Other, more elegant solutions?
Thanks so much for your wisdom!
I'll set aside whether you should do this. Other answerers have said what I have to say about that.
Technically how you'd do this is by looking for any data that persists when a user updates the app. So, any NSUserDefaults values you've set, anything you've written to the app's sandbox, keychain values... Any hint you've been here before, and you set yourself a userDefaults flag to only show old stuff. Otherwise, set yourself a flag to only show new stuff.
If you want 2 different app behaviors, you can just submit a new different app to the App store. Apple may or may not like "hidden" behaviors that they can't find during review.
the most elegant solution that I can think of is letting the user choose.
if your changes are so well delimited that you can use a flag (like you say in your question) to decide which code you run, I would add a setting useNewUI
which is by default YES unless you detect the app was already installed (read further for more details about this). Then the user can go to the settings (you might also ask them) and decide and at any moment change.
You could decide whether your user is a new or an old one by checking whatever data you are storing in NSUserDefaults
. At the start of the program, you check, if data is there, then you add useNewUI
to NSUserDefault with a value of NO, otherwise you add it with value YES.
This approach could based on NSUserDefault could be useful to you even if you disregard the possibility of letting the user choose through a setting.
If the app is radically different, then make a new app. Otherwise, anyone who updates will get the new one.
Some existing users may want to have the new one, some may want the old one. This gives everyone the choice.
You can't. Once you submit an update, all of your users can download it and will have the new feature. If the update is going to annoy your existing customers, it will probably annoy your new users too.
精彩评论