Advertisement
Guest User

Untitled

a guest
May 4th, 2015
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
  2. {
  3.  
  4. #if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_8_0 //__IPHONE_8_0 is not defined in old xcode (==0). Then use 80000
  5.  
  6. NSLog(@"registerForPushNotification: For iOS >= 8.0");
  7.  
  8. [[UIApplication sharedApplication] registerUserNotificationSettings:
  9. [UIUserNotificationSettings settingsForTypes:
  10. (UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge)
  11. categories:nil]];
  12. [[UIApplication sharedApplication] registerForRemoteNotifications];
  13. #endif
  14. }
  15. else {
  16. NSLog(@"registerForPushNotification: For iOS < 8.0");
  17. [[UIApplication sharedApplication] registerForRemoteNotificationTypes:
  18. (UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement