Memory is Not Unlimited
Memory is a critical resource in iPhone OS, so managing memory in your application is crucial. Because the
iPhone OS virtual memory model does not include disk swap space, you must take care to avoid allocating
more memory than is available on the device. When low-memory conditions occur, iPhone OS warns the
running application and may terminate the application if the problem persists. Be sure your application is
responsive to memory usage warnings and cleans up memory in a timely manner.
As you design your application, strive to reduce the application’s memory footprint by, for example, eliminating
memory leaks, making resource files as small as possible, and loading resources lazily. See iPhone Application
Programming Guide for extensive information about how to design iPhone applications that handle memory
appropriately.
One Screen at a Time
One of the biggest differences between the iPhone OS environment and the computer environment is the
window paradigm. With the exceptions of some modal views, users see a single application screen at a time
on an iPhone OS–based device. iPhone applications can contain as many different screens as necessary, but
users access and see them sequentially, never simultaneously.
If the desktop version of your application requires users to see several windows simultaneously, you need
to decide if there’s a different way users can accomplish the same task in a single screen or a sequence of
screens. If not, you should focus your iPhone application on a single subtask of your computer application,
instead of trying to replicate a wider feature set.
One Application at a Time
Only one iPhone application can run at a time, and third-party applications never run in the background.
This means that when users switch to another application, answer the phone, or check their email, the
application they were using quits. It’s important to make sure that users do not experience any negative
effects because of this reality. In other words, users should not feel that leaving your iPhone application and
returning to it later is any more difficult than switching among applications on a computer.
The most effective thing you can do to ensure that users have a positive application-switching experience
is to pare the launch time of your application to the minimum. See iPhone Application Programming Guide
for guidance on how to make your application’s launch time as short as possible.
In general, users quit your application by switching to another application or service on the device; they take
no specific action to close your application. Therefore, do not expect users to select Quit from a menu or
click a close button. This means that your application is likely to quit without much warning, so you should
be prepared to save user changes as they are made, as quickly as possible. Doing so allows a fast, smooth
transition between applications and ensures that your application can reflect the user’s most recent changes
the next time it starts.
Another important facet of the single application model is the way you handle application-specific preferences.
On iPhone OS–based devices, users set preferences in the Settings application. Your iPhone application can
supply such preferences, but this means that they must quit your application when they want to access them
in Settings. If you follow the standard guidelines and offer settings that users need to set once, and then
rarely, if ever, again, the user experience of your application should be smooth.
16
Platform Differences to Keep in Mind
2009-03-04 | © 2009 Apple Inc. All Rights Reserved.
CHAPTER 1
The iPhone OS Platform: Rich with Possibilities