64x64 icon dark hosting
Choose a hosting plan here and get a free year's subscription to Tuts+ (worth $180).
Advertisement

iOS Multitasking: Background Tasks

by
Gift

Start a hosting plan from $3.92/mo and get a free year on Tuts+ (normally $180)

This post is part of a series called iOS Multitasking.
iOS Multitasking: Background Audio
iOS Multitasking: Background Location

This is the third part in the iOS Multitasking Series. Compared to Local Notifications, Background Audio, Background Location, and VOIP (Not covered in this series), Background Tasks and Fast App Switching are the easiest to implement. For this tutorial, you will need to understand blocks.

Step 1: Creating the Project

For the simplicity of this tutorial, create a window based application so we do not have to deal with View Controllers and extras (same implementation is used no matter what template you use). Name it Background Task and uncheck "Use Core Data" and "Include Unit Tests".

iOS_Background_Tasks

Then open up the Background_TasksAppDelegate.m.

Step 2: Implementing the code

Now scroll down to the applicationDidEnterBackground: method and add the following code:

Wrap Up

As you can see, Background Tasks are extremely short and easy to implement. If you have any need for help or just want to post a suggesion, then comment below!

Advertisement