Contents

getPendingNotificationRequests(completionHandler:)

Fetches all of your app’s local notifications that are pending delivery.

Declaration

func getPendingNotificationRequests(completionHandler: @escaping  @Sendable ([UNNotificationRequest]) -> Void)
func pendingNotificationRequests() async -> [UNNotificationRequest]

Parameters

  • completionHandler:

    A block for processing notification requests. This block may be executed on a background thread. The block has no return value and takes a single parameter.

    requests

    An array of Unnotificationrequest objects representing the scheduled notification requests. If there are no scheduled requests, this array is empty.

Discussion

Here’s an example that obtains the pending notification requests.

let center = UNUserNotificationCenter.current()
let requests = await center.pendingNotificationRequests()

See Also

Scheduling notifications