Instance Method

getNotificationSettings(completionHandler:)

Requests the notification settings for this app.

Declaration

func getNotificationSettings(completionHandler: @escaping (UNNotificationSettings) -> Void)

Parameters

completionHandler

The block to execute asynchronously with the results. This block may be executed on a background thread. The block has no return value and takes the following parameter:

settings

The UNNotificationSettings object containing the current authorization settings for your app.

Discussion

Use this method to determine the user interactions and notification-related features that your app is authorized to use. You might then use this information to enable or disable specific notification-related features of your app.

When the user initially grants authorization to your app, the system gives your app a set of default notification-related settings. The user may change those settings at any time to enable or disable specific capabilities. For example, the user might disable the playing of sounds when a notification arrives.

See Also

Managing Settings and Authorization

func requestAuthorization(options: UNAuthorizationOptions, completionHandler: (Bool, Error?) -> Void)

Requests authorization to interact with the user when local and remote notifications are delivered to the user's device.

var supportsContentExtensions: Bool

A Boolean value indicating whether the current device supports notification content extensions.

struct UNAuthorizationOptions

Constants for requesting authorization to interact with the user.

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