Is it possible to show an alert according to the app usage or to the app update?
I would show an alert to the user开发者_运维问答 when the user updates the app (not at the first installation) and/or show an alert to the user after the seven days app usage for example.
Is it possible? Where can I begin from?
Thanks.
For an alert when the app updates: store the app version in NSUserDefaults. On launch (use -applicationDidFinishLaunching:), check this value. If it's different from the current version, throw up an alert then update the value. If the value is empty then it's first launch.
For after seven days, do something similar: store the date of first launch in NSUserDefaults. On each launch, check if that is more than seven days ago. You might want to also store a boolean to show whether you've done this alert, as otherwise you'll be nagging users on every launch beyond seven days. You might also want to do the check in -applicationDidEnterForeground: as well.
精彩评论