101

Apple iOS Background Tasks

 4 years ago
source link: https://www.tuicool.com/articles/AN3eEvz
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.

Request the system to launch your app in the background to run tasks.

SDKs

  • iOS 13.0+ Beta
  • UIKit for Mac 13.0+ Beta
  • tvOS 13.0+ Beta

On This Page

Overview

Use the BackgroundTasks framework to keep your app content up to date and run tasks requiring minutes to complete while your app is in the background. Longer tasks can optionally require a powered device and network connectivity.

Register launch handlers for tasks when the app launches and schedule them as required. The system will launch your app in the background and execute the tasks.

Topics

Essentials

class BGTaskScheduler

A class for registering launch handlers that are run by submitting task requests to launch your app in the background.

Starting and Terminating Tasks During Development

Use the debugger to start tasks and terminate them before completion during development.

Refreshing and Maintaining Your App Using Background Tasks

Use scheduled background tasks for refreshing your app content and for performing maintenance.

Requests

class BGProcessingTaskRequest

A request to launch your app in the background to execute a processing task that can take minutes to complete.

class BGAppRefreshTaskRequest

A request to launch your app in the background to execute a short refresh task.

class BGTaskRequest

An abstract class for representing task requests.

Task Management

class BGProcessingTask

A time-consuming processing task that runs while the app is in the background.

class BGAppRefreshTask

An object representing a short task typically used to refresh content that’s run while the app is in the background.

class BGTask

An abstract class representing a task that’s run while the app is in the background.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK