Class

UNNotificationSettings

Contains the notification-related settings and authorization status of your app

Overview

A UNNotificationSettings object contains information about the current notification-related settings and authorization status for your app. Apps must request authorization before they can schedule notifications that involve user interactions such as displaying alerts, playing sounds, or badging the app’s icon. Even after authorization is granted, apps should check their authorization status at launch time in case the user revised the types of interactions that are allowed.

You do not create instances of this class directly. To retrieve the settings for your app, call the getNotificationSettings(completionHandler:) method of your app’s UNUserNotificationCenter object. You can use the information in the returned object to determine your app’s behaviors. For example, if sounds are not permitted, you should avoid specifying sounds when scheduling local notifications. Even if you do not alter the interactions you include in your notification contents, the system enforces the settings by preventing denied interactions from occurring.

For more information about requesting authorization for user interactions, see UNUserNotificationCenter.

Symbols

Getting Device Settings

var authorizationStatus: UNAuthorizationStatus

The authorization status indicating the app’s ability to interact with the user.

var notificationCenterSetting: UNNotificationSetting

The setting that indicates whether your app’s notifications are displayed in Notification Center.

var lockScreenSetting: UNNotificationSetting

The setting that indicates whether your app’s notifications appear onscreen when the device is locked.

var carPlaySetting: UNNotificationSetting

The setting that indicates whether your app’s notifications may be displayed in a CarPlay environment.

Getting User Notification Settings

var alertSetting: UNNotificationSetting

The authorization status for displaying alerts.

var alertStyle: UNAlertStyle

The type of alert that the app may display when the device is unlocked.

var badgeSetting: UNNotificationSetting

The authorization status for badging your app’s icon.

var soundSetting: UNNotificationSetting

The authorization status for playing sounds for incoming notifications.

Constants

UNAuthorizationStatus

Constants indicating whether the app is allowed to schedule notifications.

UNNotificationSetting

Constants indicating the current status of a notification setting.

UNAlertStyle

Constants indicating the types of alerts that can be displayed to the user.

Relationships

Inherits From