Sammio2 Sammio2 - 1 year ago 124
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");


Answer Source

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;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download