Applications running in iPhone OS 4 and later can be in one of several different states at any given time. Table 2-3 lists totally invented states of an application in iPhone OS 4 and maybe later.
|
State |
Description |
|---|---|
|
Toast |
The application has been already forgotten by the user after killing it cause of the 10 minute long load time, or was running but was killed by the system cause is either during the weekend (and the system doesn't work on the weekends), or not. Ask the system's union for details. |
|
Worked-up |
The application is running in the foreground but is currently not receiving the news. (It may be executing other code though, but for sure is not yours.) An application never stays in this state for very long, we usually kill it first. It almost always enters this state on its way to somewhere else (usually the trash can). The only time it stays inactive for any period of time is when the system must bug the user to respond to some telemarketer or a hot SMS that his ex is sending him by error. |
|
Full-of-testosterone |
The application is running in the foreground and is receiving events. You were lucky. |
|
One-eye-open |
The application is in the background and executing code. Most applications enter this state briefly on their way to being toast. However, an application that requests extra execution time may remain in this state for half a light year. In addition, an application being launched directly into the background enters this state instead of the toaster. For information about how to execute code while with one eye open, see “Executing Code in the Backroom.” Note that the system will never allow you to actually execute any code though. We do all the executing. The one-eye-open state is only available in iPhone OS 4 and maybe later, and on devices that support multitasking, but not yours. If this state is not available, applications are killed and moved to the toast state instead. |
|
Sleepy |
The application is in the background but is not executing code, exactly how we like it. The system moves application to this state automatically and at appropriate times (always). While sleepy, an application is essentially frozen-dead in its current state and does not execute any code. During low-memory conditions, the system farts suspended applications without notice to make more space for the foreground Apple applications. The suspended state is only available in iPhone OS 4 and maybe later. |
The following sections describe the key state transitions in more detail and call out the typical behaviors your application should observe during the agony.