Instance Method


Called to tell the delegate the types of local and remote notifications that can be used to get the user’s attention.


optional func application(_ application: UIApplication, didRegister notificationSettings: UIUserNotificationSettings)



The app object that registered the user notification settings.


The user’s specified notification settings for your app. The settings in this object may be different than the ones you originally requested.


Apps that use local or remote notifications to alert the user to new information must register the types of notifications they want to use by calling the registerUserNotificationSettings(_:) method of the app object. The system compares your app’s request with the user’s preferences to determine the types of local and remote notifications allowed, and returns the results to your app by calling this method. Check the contents of the notificationSettings parameter whenever this method is called.

Because the user can change notification settings in the Settings app at any time, call the currentUserNotificationSettings method before your app performs work to prepare a notification for presentation.

The first time you register your app’s preferred notification types, the system asks the user whether your app should be allowed to deliver notifications and stores the user’s response. The system does not prompt the user on subsequent calls to the registerUserNotificationSettings(_:) method, but the user can always change notification preferences using Settings.

A user’s notification settings control only whether the system displays local or remote notifications onscreen. Regardless of the notification settings, local and remote notifications are delivered to your app at the appropriate times.

See Also

Handling Local and Remote Notifications

func application(UIApplication, didReceive: UILocalNotification)

Sent to the delegate when a running app receives a local notification.

func application(UIApplication, handleActionWithIdentifier: String?, for: UILocalNotification, completionHandler: () -> Void)

Called when your app has been activated because user selected a custom action from the alert panel of a local notification.

func application(UIApplication, didRegisterForRemoteNotificationsWithDeviceToken: Data)

Tells the delegate that the app successfully registered with Apple Push Notification service (APNs).

func application(UIApplication, didFailToRegisterForRemoteNotificationsWithError: Error)

Sent to the delegate when Apple Push Notification service cannot successfully complete the registration process.

func application(UIApplication, handleActionWithIdentifier: String?, forRemoteNotification: [AnyHashable : Any], completionHandler: () -> Void)

Tells the app delegate to perform the custom action specified by a remote notification.

func application(UIApplication, didReceiveRemoteNotification: [AnyHashable : Any])

Called when your app has received a remote notification.