O'Reilly logo

iOS 5 Programming Cookbook by Vandad Nahavandipoor

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

12.10. Opting Out of Multitasking

Problem

You do not want your application to participate in multitasking.

Solution

Add the UIApplicationExitsOnSuspend key to your application’s main .plist file and set the value to true:

<dict>
  ...
  ...
  ...
  <key>UIApplicationExitsOnSuspend</key>
  <true/>
  ...
  ...
  ...
</dict>

Discussion

In some circumstances, you might require that your iOS applications not be multitasking (although I strongly encourage you to develop your applications to be multitasking-aware). In such cases, you can add the UIApplicationExitsOnSuspend key to your application’s main .plist file. Devices on the latest iOS versions that support multitasking understand this value and the OS will terminate an application with this key set to true in the application’s .plist file. On earlier iOS versions without support for multitasking, this value will have no meaning to the operating system and will be ignored.

When such an application runs on the latest iOS, the following application delegate messages will be posted to your application:

  1. application:didFinishLaunchingWithOptions:

  2. applicationDidBecomeActive:

If the user presses the Home button on the device, the following messages will be sent to your application delegate:

  1. applicationDidEnterBackground:

  2. applicationWillTerminate:

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required