5

Background Tasks in iOS

 2 years ago
source link: https://www.raywenderlich.com/21242372-background-tasks-in-ios
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

This course is available as part of the raywenderlich.com Professional subscription. To learn more click here

Background Tasks in iOS

Jun 15 2021 · Video Course (16 mins) · Intermediate

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.

Version

  • Swift 5, iOS 14.4, Xcode 12.5

Background Tasks in iOS

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.

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.

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.

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.

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.

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

Contributors

Adam Rush

Adam Rush is a passionate iOS developer with over 7 years of commercial experience, contracting all over the UK & Europe....

Instructor
Adriana Kutenko

Graphic Illustrator with a Bachelor’s Degree in Fine Arts. I am a perpetual perfection seeker with a big passion for History...

Illustrator

Comments


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK