ios8推送问题
registerForRemoteNotificationTypes: is not supported in iOS 8.0 and later.
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)]; }
判断PUSH是否打开
{ UIRemoteNotificationType types; if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) { types = [[UIApplication sharedApplication] currentUserNotificationSettings].types; } else { types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes]; } return (types & UIRemoteNotificationTypeAlert); }
原文地址:http://blog.csdn.net/cerastes/article/details/39546625