Sammio2 Sammio2 - 6 months ago 57
Objective-C Question

How to interrogate UIUserNotificationSettings types

I am trying to implement the

App Delegate method to try and identify if i am allowed to send local notifications to the user in iOS 8. The following is the kind of thing i'm trying to achieve, but this is obviously the incorrect way of going about it.

- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings

if (notificationSettings.types /*How do i check which types are contained */) {


} else {

NSLog(@"Not Allowed");



Here you go

if (notificationSettings.types == UIUserNotificationTypeNone) {
      NSlog(@"Permission not Granted by user");
      NSlog(@"Permission Granted");

To interrogate a specific setting:

BOOL allowsSound = (notifSettings.types & UIUserNotificationTypeSound) != 0;