IOS – How are iOS apps actually opened from their sleep state

application-switcherios

I have noticed that when I open an app from the App Switcher it actually shows me a screenshot of the latest state of the app instead of showing me the real app.

Can someone clarify the process of opening apps from the background?

Best Answer

Because the action of quitting an app actually uses some battery power in the process of doing so (e.g. clearing it from RAM, etc) and then again later when the app is launched again, iOS is designed so that it’s usually best to leave apps open.

Now, even though they’re open, they’re really just sitting in a type of suspended mode that isn’t using any battery power whatsoever. So, while the app is still loaded in RAM and taking space, it’s not actually doing anything - it’s just lying there dormant.

For this reason you only need to quit apps if they're not working properly (e.g. an app has frozen, it isn't displaying properly, etc).

So, usually apps listed within the App Switcher are not necessarily running - in fact most of them are not running at all. Most apps in the App Switcher are in a suspended state - this means they're not: visible on screen, executing code, using the CPU or GPU, or using the battery. However, they are still resident in memory until they are purged (if necessary) by the system to free up memory.

Now, what happens here is that the last screen displayed by most apps is what's stored in this suspended state. So, the screenshot you're seeing is not really a screenshot per se, but the last known state displayed by the app prior to it being suspended.

See below reference for further info:

Suspended - The app is in the background but is not executing code. The system moves apps to this state automatically and does not notify them before doing so. While suspended, an app remains in memory but does not execute any code. When a low-memory condition occurs, the system may purge suspended apps without notice to make more space for the foreground app.

Source: See Table 2-3 in Apple's App Programming Guide for iOS: Execution States for Apps.