Today we are going to talk about the Five Execution states of an iOS app. The iOS operating system gives you a chance to make appropriate changes during most of the transitions.
The iOS operating system manages the application state, but the application itself is responsible for managing important tasks to ensure the smooth transition between the states. You are required to respond appropriately to application state transitions. At any given moment, your application would be in one of the below five states.
Not Running — This is the basic state where the app is not doing anything. Either the application has not started or was running and has been terminated by the system. This state is the first state when the app is just downloaded from app store.
Not Running → Inactive → Active
Inactive — Mostly this a transitional state. An application is running in the Foreground but is not receiving any events. This could happen in case a Call or Message is received. An application could also stay in this state while in transition to a different state. Some code can run in this state but this state
Active — This the main execution state. The app is visible on the main screen and its running in the Foreground and receiving the events. This is the normal mode for the Foreground apps. The only way to go to or from the Active state is through the Inactive state.
Active → Inactive → Background → Suspended
Background — This state occurs when
Suspended — An application is in the background but is not executing the code.
Suspended → Background → Inactive → Active.