Do you know a way to pass from UIUserNotificationTypeNone to UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound (iOS8)?
To pass to UIUserNotificationTypeNone works well but not when the user try to switch again to enable ...
This is my code:
// Register for Push Notifications, if running iOS 8 if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) { UIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound); UIUserNotificationSettings * settingsAvailable = [UIUserNotificationSettings settingsForTypes:userNotificationTypes categories:nil]; [application registerUserNotificationSettings:settingsAvailable]; [application registerForRemoteNotifications]; } else { // Register for Push Notifications before iOS 8 [application registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound)]; }
After switch to enable the method of delegate "didRegisterUserNotificationSettings"
// Register to receive notifications [application registerForRemoteNotifications]; NSLog(@"The app is registered for the types: %@", notificationSettings);
returns:
The app is registered for the types: <UIUserNotificationSettings: 0x15e9e790; types: (none);>
Thanks in advance