O'Reilly logo

iOS 5 Programming Pushing the Limits: Developing Extraordinary Mobile Apps for Apple iPhone, iPad, and iPod Touch by Mugunth Kumar, Rob Napier

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

Chapter 9: Controlling Multitasking

There are two broad meanings of “multitasking” in iOS. First, it refers to running multiple applications at the same time by allowing one or more applications to run “in the background.” Second, it refers to when a single application runs multiple operations simultaneously. Both are important parts of many iOS applications, and this chapter discusses both.

You learn the best practices for multitasking and discover the major iOS frameworks for multitasking: run loops, threads, operations, and Grand Central Dispatch (GCD). If you are familiar with thread-based multitasking from other platforms, you learn how to reduce your reliance on explicit threads and make the best use of iOS’s frameworks that avoid threads or handle threading automatically. Perhaps most importantly, you learn how to give your users the illusion of multitasking without wasting system resources.

In this chapter, I assume that you understand the basics of running tasks in the background, and that you are familiar with beginBackgroundTaskWithExpirationHandler:, registering an app as location aware, and similar backgrounding issues. If you need information about the fundamental technologies, see “Executing Code in the Background” in the iOS Application Programming Guide.

Similarly, this chapter assumes that you have at least a passing familiarity with operation queues and Grand Central Dispatch, though you may never have used them in real code. If you have never heard of them, ...

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