Skip to content

Instantly share code, notes, and snippets.

@MoathOthman
Created March 3, 2015 07:16
Show Gist options
  • Save MoathOthman/8690ccefa3d6b19b3790 to your computer and use it in GitHub Desktop.
Save MoathOthman/8690ccefa3d6b19b3790 to your computer and use it in GitHub Desktop.
Register for push notifications - objc
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
{ [[UIApplication sharedApplication] registerUserNotificationSettings:
[UIUserNotificationSettings settingsForTypes:
(UIUserNotificationTypeSound |
UIUserNotificationTypeAlert |
UIUserNotificationTypeBadge) categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
else
{
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIUserNotificationTypeBadge |
UIUserNotificationTypeSound |
UIUserNotificationTypeAlert)];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment