Background Tasks in iOS

Launching your iOS app in the background and performing some tasks wasn’t all that easy. However, in iOS 13 Apple introduced an all new framework called Background Tasks. It’s incredibly powerful framework that allows you to launch your iOS application in the background and perform some important tasks ready when your users return. In this course we’re going to explore the all new framework and build out a sample project to update a list of music from the iTunes API. By Adam Rush.

3.2 (10) · 2 Reviews

Download materials
Save for later
Comments
Share

Who is this for?

This course is for anyone interested in running background tasks in their iOS application or just learning about the framework introduced by Apple.

Covered concepts

  • Background Tasks framework
  • Launching tasks in the background

Part 1: Background Tasks in iOS

01
Toggle description

To get started using the Background Tasks framework, we need to setup our project capabilities. These capabilities allow Xcode to recognise that you would like to use background tasks. You also need to create some new values within the Info.plist.

Toggle description

Background Tasks framework requires you to register every background task that is required. You do this via identifiers and registering with the framework. You also need to declare these identifiers inside the Info.plist.

Toggle description

Your background task is going to hit this API and download an updated list from the API, so that when a user returns they can see the latest music very quickly. In this episode you will write the logic to handle this refresh.

Toggle description

In the Background Task framework we also get access to a processing task, this is primarily used for intensive tasks such as training an ML model or cleaning a database. In this episode, explore scheduling a processing task and how this could work for you in your iOS app.

Toggle description

In this episode, explore all the ways of testing a background task. It can be quite daunting when you have done all this logic and wonder what is the best way to make sure this happens in the cirumstances you want.