Silent Notifications in tvOS 11 beta 3

Hello,

I am trying to implement Silent Notification in tvOS 11 beta 3. With Xcode 9 beta 3 I am not able to find the below API in the UNUserNotificationCenterDelegate protocol

func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response:UNNotification, withCompletionHandler completionHandler: @escaping () -> Void)


As per WWDC's Whats new in tvOS the above mentioned method should be available in UNUserNotificationCenterDelegate protocol.

Is this intended or is there any other way we can use a similar delegate method to receive a silent notification?


Thanks.

Replies

I can not get this to work either....i get a bit further when I added this line import UserNotifications


but then get the error Cannot assign value of type 'AppDelegate' to type 'UNUserNotificationCenterDelegate?'


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

UNUserNotificationCenter.current().delegate = self // error on this line

application.registerForRemoteNotifications()

return true

}


func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response:

UNNotification, withCompletionHandler completionHandler: @escaping () -> Void) {

//set up in-app alert

}

Once I added the extral UNUserNotificationCenterDeletgate to the class line I was able to get my error to disappear.


class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {


Now to test to see if it works.