Created
January 27, 2015 15:10
-
-
Save akozlik/12521fe329c69f28f9e9 to your computer and use it in GitHub Desktop.
iOS 7 and 8 notification backwards compatibility
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert | | |
UIUserNotificationTypeBadge | | |
UIUserNotificationTypeSound); | |
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:userNotificationTypes | |
categories:nil]; | |
if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) { | |
[application registerUserNotificationSettings:settings]; | |
[application registerForRemoteNotifications]; | |
} else { | |
UIRemoteNotificationType myTypes = UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound; | |
[application registerForRemoteNotificationTypes:myTypes]; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment