Deco Deco - 1 year ago 113
Swift Question

How do I enable notifications for iOS 10?

In iOS9 we prompt our user if they'd like notifications and direct them to the settings page so they can enable notification permission for our app. However as shown below there is no option to enable notifications in my apps permissions settings within iOS 10. Is there a new process I must undertake to populate this list with the appropriate permissions?

enter image description here


//check the notifications status. First the global settings of the device, then our stored settings
func checkGlobalNotifications() {
let grantedSettings = UIApplication.sharedApplication().currentUserNotificationSettings()
if grantedSettings!.types.rawValue & UIUserNotificationType.Alert.rawValue != 0 {
globalNotificationsEnabled = true
//if global notifications are on, then check our stored settings (user)
if CallIn.Settings.notificationsEnabled { notificationsOn() } else { notificationsOff() }
else {
globalNotificationsEnabled = false
//global notifications (iOS) not allowed by the user so disable them

Answer Source

iOS 10 has introduced UNUserNotificationCenter, which is used now for all local and push notifications. For example:

    UNUserNotificationCenter.current().requestAuthorization(options: [.alert])
    { (granted, error) in
        if granted == true{
        if let error = error {
            NSLog("Error: \(error.description)")


You can check the settings using getNotificationSettings()

WWDC video: