<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "BackgroundTasks",
  "identifier" : "/documentation/BackgroundTasks/BGTaskScheduler/submitTaskRequest(_:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Background Tasks"
    ],
    "preciseIdentifier" : "c:objc(cs)BGTaskScheduler(im)submitTaskRequest:completionHandler:"
  },
  "title" : "submitTaskRequest(_:completionHandler:)"
}
-->

# submitTaskRequest(_:completionHandler:)

Submits a background task request to be scheduled with a completion handler.

```
func submitTaskRequest(_ taskRequest: BGTaskRequest, completionHandler: @escaping @Sendable ((any Error)?) -> Void)
```

## Parameters

`taskRequest`

The task request object representing the parameters of the background task to be scheduled.

`completionHandler`

A block that is called when submission completes. The block receives an optional error parameter:

- `nil` if the task was submitted successfully
- An `NSError` if submission failed

## Discussion

This method asynchronously submits the task request and invokes the completion
handler with any errors that occur during submission.

Submitting a task request for an unexecuted task that’s already in the queue replaces the previous task request.

There can be a total of 1 refresh task and 10 processing tasks scheduled at any time. Trying to schedule more tasks
will result in an error with code [`BGTaskScheduler.Error.Code.tooManyPendingTaskRequests`](/documentation/BackgroundTasks/BGTaskScheduler/Error/Code/tooManyPendingTaskRequests).

Common errors include:

- [`BGTaskScheduler.Error.Code.notPermitted`](/documentation/BackgroundTasks/BGTaskScheduler/Error/Code/notPermitted): Task identifier not permitted or unsupported resources requested
- [`BGTaskScheduler.Error.Code.tooManyPendingTaskRequests`](/documentation/BackgroundTasks/BGTaskScheduler/Error/Code/tooManyPendingTaskRequests): Too many pending tasks of this type
- [`BGTaskScheduler.Error.Code.unavailable`](/documentation/BackgroundTasks/BGTaskScheduler/Error/Code/unavailable): Background refresh disabled or app not permitted
- [`BGTaskScheduler.Error.Code.immediateRunIneligible`](/documentation/BackgroundTasks/BGTaskScheduler/Error/Code/immediateRunIneligible): Immediate run not eligible due to system conditions

The completion handler is called on an arbitrary queue.

> Note: The completion handler may be invoked on an arbitrary queue after an arbitrary amount of delay.
> Do not call this method from the main thread or performance-critical contexts.

This method replaces the deprecated [`submit(_:)`](/documentation/BackgroundTasks/BGTaskScheduler/submit(_:)) method.

---

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)