Is it mandatory to use UNUserNotificationCenter implementation with the following code to get(make work) push notification in iOS10 ?
if #available(iOS 10.0, *){
UNUserNotificationCenter.currentNotificationCenter().delegate = self
UNUserNotificationCenter.currentNotificationCenter().requestAuthorizationWithOptions([.Badge, .Sound, .Alert], completionHandler: {(granted, error) in
if (granted)
{
UIApplication.sharedApplication().registerForRemoteNotifications()
}
else{
//Do stuff if unsuccessful...
}
})
}
Or is it just enough to just make the following to receive push notification to the existing app ?
- Import UserNotifications.framework
- Under "Capabilities"
- Turn on "Push Notification"
- Check "Remote Notification" checkbox under "Background Modes"
And please official documentation denoting this if any.