You should do this in applicationDidEnterBackground:
applicationWillTerminate will not be when the user enters the home button. With application switching, this is only sent when the user explicitly closes the application, or possibly memory.
applicationWillResignActive - this is additionally called when the application is interrupted briefly, for example, via SMS or phone notification. (Although if the user then switches to the βMessagesβ or βPhoneβ application, your application will eventually receive the applicationDidEnterBackground message).
So, it seems that you are particularly interested in the moment when the user enters the home button, and the application goes to the background. applicationDidEnterBackground is the place.
You can also always schedule a local notification and respond to it only if the application does not work when it occurs. Not necessarily better, just an option to consider.
kball source share