I have this piece of code that works in iOS7. It gives me the ability to shut off sound, alert and badge. If showMessage,showBadge or show sound
is set to zero the corresponding UIremote type is turned off as well. As many of you know, iOS8 remote notifications has changed. Can someone please direct me how to make this work for iOS 8?
UIRemoteNotificationType notificationType = UIRemoteNotificationTypeNone;
if (showMessage == 1 )
notificationType |= UIRemoteNotificationTypeAlert;
if (showBadge == 1 )
notificationType |= UIRemoteNotificationTypeBadge;
if (showSound == 1 )
notificationType |= UIRemoteNotificationTypeSound;
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:notificationType];
This is what I tried, but I get the error No visible @interface 'UIApplication' declares the selector 'registerForUserNotificationSettings:'
UIUserNotificationType userNotificationType = UIUserNotificationTypeNone;
if (showMessage == 1 )
userNotificationType |= UIUserNotificationTypeAlert;
if (showBadge == 1 )
userNotificationType |= UIUserNotificationTypeBadge;
if (showSound == 1 )
userNotificationType |= UIUserNotificationTypeSound;
[[UIApplication sharedApplication] registerForUserNotificationSettings:userNotificationType];