Skip to content

Instantly share code, notes, and snippets.

@alexruperez
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexruperez/8a041538f89dbac984d8 to your computer and use it in GitHub Desktop.
Save alexruperez/8a041538f89dbac984d8 to your computer and use it in GitHub Desktop.
- registerForRemoteNotificationTypes:categories: NS_AVAILABLE_IOS(3_0); ( iOS 8 Compatible )
- (void)registerForRemoteNotificationTypes:(NSUInteger)notificationTypes categories:(NSSet *)categories
{
if ([UIApplication instancesRespondToSelector:@selector(registerUserNotificationSettings:)] && [UIApplication instancesRespondToSelector:@selector(registerForRemoteNotifications)])
{
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:notificationTypes categories:categories]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
else if ([UIApplication instancesRespondToSelector:@selector(registerForRemoteNotificationTypes:)])
{
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:notificationTypes];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment