To eliminate any confusion, I just ran a few tests on a device with iOS 4.3.2:
When you start the application, your application is sent: application: didFinishLaunchingWithOptions: applicationDidBecomeActive:
When you press the home button, your application will be sent:
applicationWillResignActive: applicationDidEnterBackground:
When you restart this application, the application is sent:
applicationWillEnterForeground: applicationDidBecomeActive:
When you press the lock button, your application will be sent:
applicationWillResignActive:
When you unlock, your application is sent:
applicationDidBecomeActive:
When you receive a call, your application is sent:
applicationWillResignActive:
If you do not answer this call, your application will be sent:
applicationDidBecomeActive:
When you receive a call, your application is sent:
applicationWillResignActive:
If you answer this call, your application will be sent:
applicationDidEnterBackground:
When you hang up, your application is sent:
applicationWillEnterForeground: applicationDidBecomeActive:
I would say when you receive applicationWillResignActive
: then you must log out, cancel authentication, block or cancel your confidential information, and when you receive applicationDidBecomeActive:
then re-authenticate. This call is called at startup, returns from the background and unlocks the device.
In addition, these two methods may be of interest to you, but they really do not help the specific case that interests you:
- (void)applicationProtectedDataWillBecomeUnavailable:(UIApplication *)application - (void)applicationProtectedDataDidBecomeAvailable:(UIApplication *)application