Instance Property

alertSetting

The authorization status for displaying alerts.

Declaration

iOS, Mac Catalyst, watchOS
@property(readonly, nonatomic) UNNotificationSetting alertSetting;
macOS
@property(readonly, atomic) UNNotificationSetting alertSetting;

Discussion

When the value of this property is UNNotificationSettingEnabled, the app is authorized to display alerts. Authorization does not guarantee that alerts always appear on the user’s screen. When a device is unlocked, the alertStyle property determines the presentation style for the alert, which can include not displaying the alert at all.

The system tries to display an alert when the title, subtitle, or body properties of a UNNotificationContent object contain values, or when the aps dictionary in a remote notification contains the alert key.

See Also

Getting Device-Specific Settings

notificationCenterSetting

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

lockScreenSetting

The setting that indicates whether your app’s notifications appear on a device’s Lock screen.

carPlaySetting

The setting that indicates whether your app’s notifications appear in CarPlay.

badgeSetting

The setting that indicates whether badges appear on your app’s icon.

soundSetting

The authorization status for playing sounds for incoming notifications.

criticalAlertSetting

The authorization status for playing sounds for critical alerts.

announcementSetting

The setting that indicates whether Siri can announce your app’s notifications.

UNNotificationSetting

Constants that indicate the current status of a notification setting.