---
title: "getPendingTaskRequests(completionHandler:)"
framework: backgroundtasks
role: symbol
role_heading: Instance Method
path: "backgroundtasks/bgtaskscheduler/getpendingtaskrequests(completionhandler:)"
---

# getPendingTaskRequests(completionHandler:)

Request a list of unexecuted scheduled task requests.

## Declaration

```swift
func getPendingTaskRequests(completionHandler: @escaping @Sendable ([BGTaskRequest]) -> Void)
```

```swift
func pendingTaskRequests() async -> [BGTaskRequest]
```

## Parameters

- `completionHandler`: The completion handler called with the pending tasks. The handler may execute on a background thread. The handler takes a single parameter tasksRequests, an array of BGTaskRequest objects. The array is empty if there are no scheduled tasks. The objects passed in the array are copies of the existing requests. Changing the attributes of a request has no effect. To change the attributes submit a new task request using doc://com.apple.backgroundtasks/documentation/BackgroundTasks/BGTaskScheduler/submit(_:).

## Discussion

Discussion note: You can call this method from synchronous code using a completion handler, as shown on this page, or you can call it as an asynchronous method that has the following declaration: func pendingTaskRequests() async -> [BGTaskRequest] For information about concurrency and asynchronous code in Swift, see Calling Objective-C APIs Asynchronously.
