<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "BackgroundTasks",
  "identifier" : "/documentation/BackgroundTasks/BGTaskScheduler",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Background Tasks"
    ],
    "preciseIdentifier" : "c:objc(cs)BGTaskScheduler"
  },
  "title" : "BGTaskScheduler"
}
-->

# BGTaskScheduler

A class for scheduling tasks that add background support to your app’s most critical work.

```
class BGTaskScheduler
```

## Overview

Background tasks give your app a way to run code even when the app is suspended:

- To register, schedule, and run tasks in the background, see <doc://com.apple.documentation/documentation/UIKit/using-background-tasks-to-update-your-app>.
- To submit work in the foreground that can finish even if the app moves to the background, see [Performing long-running tasks on iOS and iPadOS](/documentation/BackgroundTasks/performing-long-running-tasks-on-ios-and-ipados).

## Topics

### Getting the shared task scheduler

[`sharedScheduler`](/documentation/BackgroundTasks/BGTaskScheduler/shared)

The shared background task scheduler instance.

### Checking task requirements

[`supportedResources`](/documentation/BackgroundTasks/BGTaskScheduler/supportedResources)

Additional system resources that a continuous background task can request.

### Scheduling a task

[`-  registerForTaskWithIdentifier:usingQueue:launchHandler:`](/documentation/BackgroundTasks/BGTaskScheduler/register(forTaskWithIdentifier:using:launchHandler:))

Register a launch handler for the task with the associated identifier that’s executed on the specified queue.

[`-  submitTaskRequest:error:`](/documentation/BackgroundTasks/BGTaskScheduler/submit(_:))

Submit a previously registered background task for execution.

### Canceling a task

[`-  cancelTaskRequestWithIdentifier:`](/documentation/BackgroundTasks/BGTaskScheduler/cancel(taskRequestWithIdentifier:))

Cancel a previously scheduled task request.

[`-  cancelAllTaskRequests`](/documentation/BackgroundTasks/BGTaskScheduler/cancelAllTaskRequests())

Cancel all scheduled task requests.

### Getting all scheduled tasks

[`-  getPendingTaskRequestsWithCompletionHandler:`](/documentation/BackgroundTasks/BGTaskScheduler/getPendingTaskRequests(completionHandler:))

Request a list of unexecuted scheduled task requests.

### Handling errors

[`Error`](/documentation/BackgroundTasks/BGTaskScheduler/Error)

The Errors for the `BGTaskSchedulerError` domain.

[`Code`](/documentation/BackgroundTasks/BGTaskScheduler/Error/Code)

An enumeration of the task scheduling errors.

[`BGTaskSchedulerErrorDomain`](/documentation/BackgroundTasks/BGTaskScheduler/errorDomain)

The background tasks error domain as a string.

## Relationships

### Conforms To

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Hashable`](/documentation/Swift/Hashable)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)