How can I use UNNotificationSettings
to get the notification type in iOS 10?
On previous iOS, I would use this:
UIUserNotificationSettings *notificationSettings = [[UIApplication sharedApplication] currentUserNotificationSettings];
Bool active = notificationSettings.types == UIUserNotificationTypeNone ? NO: YES;
I hope you are asking about this
UNUserNotificationCenter.currentNotificationCenter().getNotificationSettingsWithCompletionHandler{ (mySettings) in mySettings.alertStyle == .None }
Swift 4
UNUserNotificationCenter.current().getNotificationSettings{ (mySettings) in mySettings.alertStyle == .none }
For Objective-C
[[UNUserNotificationCenter currentNotificationCenter] getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) {
settings.alertStyle == UNAlertStyleNone
}]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With