Open "Appname Notification Settings"

I did what is described in "Check out What’s New in User Notifications from #WWDC18" https://developer.apple.com/wwdc18/710 around 27:36, in order to add a button "Appname Notification Settings" at the bottom of the app's notification page in Settings; I implemented the


func userNotificationCenter(_ center: UNUserNotificationCenter, openSettingsFor notification: UNNotification?) {


protocol function, but the button does not show up in the page in Settings. Is this a bug in iOS 12 beta?


Note: currently only using simulator

Answered by zappy in 315933022

The information in the video was not enough.


This is needed also.


let center = UNUserNotificationCenter.current()

var options: UNAuthorizationOptions = [.alert, .sound]

if #available(iOS 12.0, *) {

options.insert(.providesAppNotificationSettings)

}

center.requestAuthorization(options: options) {



i.e. when requesting authorization, add .providesAppNotificationSettings for iOS12.

Accepted Answer

The information in the video was not enough.


This is needed also.


let center = UNUserNotificationCenter.current()

var options: UNAuthorizationOptions = [.alert, .sound]

if #available(iOS 12.0, *) {

options.insert(.providesAppNotificationSettings)

}

center.requestAuthorization(options: options) {



i.e. when requesting authorization, add .providesAppNotificationSettings for iOS12.

Open "Appname Notification Settings"
 
 
Q