Whenever the user selects once, and the application will run in the background at this time, applicationDidEnterBackground always calls. In this method, you can temporarily update / save the value of NSUserDefaults.
If in case the application reappears in the foreground with termination with double taps, it calls applicationDidBecomeActive , in which you can update / delete the temporarily saved NSUserDefaults value again. And if the user closes the application with double labels, the stored value will be stored in NSUserDefaults.
alloc_iNit
source share