Appearance
When will applicationWillTerminate be Called
When you remove the app from the multitasking UI. There has three different behaviours depending on the state of the app:
If the app is running, it triggers programmatic termination.
Specifically, it ends up calling the-applicationWillTerminate:
app delegate method (a common feature of iOS development before iOS introduced multitasking but now only called in this specific edge case).If the app is suspended in the background, it simply removes it from memory.
If the app is not running at all, it does nothing.
In all three cases it then goes on to do all the other actions associated with this gesture, notably, removing the app from the multitasking UI and flagging it to not be launched in the background.
In the second two cases it's over.
In the first case, programmatic termination continues as follows:
After your-applicationWillTerminate:
method returns, UIKit starts terminating the app. This eventually callsexit
.
References
Forced exit of the application will have abnormal crash data