5 Status of iOS apps
The Not Running (non-running) app is not running or terminated by the system.
Inactive (foreground inactive) app is entering foreground state, but cannot accept event handling.
The active (foreground active status) app enters the foreground state and can accept event handling.
After the Background (background state) application enters the background, the code can still be executed. If you have executable code, you execute the code.
Suspended (hangs) a self-suspending application enters a "frozen" state and cannot execute code. If the system does not have enough memory, the application is terminated.
Second, the iOS application state changes the corresponding method description
Method |
Local notifications |
Description |
Application:didfinishlaunchingwithoptions: |
Uiapplicationdidfinshlaunchingnotification |
The method is invoked and notified when the app is started and initialized. This stage instantiates the root view controller |
Applicationdidbecomeactive |
Uiapplicationdidbeconmeactivenotification |
The method is called and notified when the app enters the foreground and is active. This stage can restore the UI state (e.g. game state, etc.) |
Applicationwillresignactive |
Uiapplicationwillresignactivenotification |
The method is called when the app is from active state to inactive state and is notified. This stage can save the UI state (such as game state, etc.) |
Applicationdidenterbackground |
Uiapplicationdidenterbackgroundnotificaiton |
The method is called and notified when the app enters the background. This stage can save the user data, release some resources (such as freeing up the database resources, etc.) |
Applicationwillenterforeground |
Uiapplicationwillenterforegroundnotification |
The method is called and notified when the app enters the foreground, but is not yet active. This phase can restore the data user |
Applicationwillterminate |
Uiapplicationwillterminatenotification |
The method is called when the app is terminated, except when the memory is cleared. This phase frees up some resources and can also save user data |
iOS app life cycle