When I look at Apple's documentation on "Managing Your App's Notification Support" it says that for requestAuthorizationWithOptions(:)
"If your app is authorized for all of the requested interaction types, the system calls your completion handler block with the
granted parameter set to YES. If one or more interaction type is disallowed, the parameter is NO"This is not the behavior I'm seeing though. If I ask for badge, sound and alert, and then I go into settings and disable badge and sound, I'm still getting granted set to true. Am I misunderstanding how that's supposed to work? This is how I always register for push notifications:
let center = UNUserNotificationCenter.current()
center.requestAuthorization(options: [.badge, .sound, .alert]) {
[weak center, weak self] granted, _ in
guard granted, let center = center, let `self` = self else { return }
center.delegate = self
center.getNotificationSettings { settings in
guard settings.authorizationStatus == .authorized else { return }
DispatchQueue.main.async {
application.registerForRemoteNotifications()
}
}
}