Class

UIUserNotificationSettings

Important: UIUserNotificationSettings is deprecated in iOS 10. Use UNNotificationSettings instead. A UIUserNotificationSettings object encapsulates the types of notifications that can be displayed to the user by your app.

Overview

Apps that use visible or audible alerts in conjunction with a local or push notification must register the types of alerts they employ. UIKit correlates the information you provide with the user’s preferences to determine what types of alerts your app is allowed to employ.

Use this class to encapsulate your initial registration request and to view the request results. After creating an instance of this class and specifying your preferred settings, call the registerUserNotificationSettings(_:) method of the UIApplication class to register those settings. After checking your request against the user preferences, the app delivers the results to the application(_:didRegister:) method of its app delegate. The object passed to that method specifies the types of notifications that your app is allowed to use.

In addition to registering your app’s alert types, you can also use this class to register groups of custom actions to display in conjunction with local or push notifications. Custom actions represent immediate tasks your app can perform in response to the notification. You define groups of actions and associate the entire group with a given notification. When the corresponding alert is displayed, the system adds buttons for each action you specified. When the user taps the button for one of the actions, the system wakes your app and calls the application(_:handleActionWithIdentifier:forRemoteNotification:completionHandler:) or application(_:handleActionWithIdentifier:for:completionHandler:) method of its app delegate. Use those methods to perform the requested action.

Symbols

Creating a Settings Object

init(types: UIUserNotificationType, categories: Set<UIUserNotificationCategory>?)

Creates and returns a settings object that you can use to register your requested notification and action types.

Getting the Configured Settings

var types: UIUserNotificationType

A bitmask of the notification types that your app is allowed to use.

var categories: Set<UIUserNotificationCategory>?

The app’s registered groups of actions.

Constants

UIUserNotificationType

Constants indicating how the app alerts the user when a local or push notification arrives.

Relationships

Inherits From

Conforms To