我已使用以下方法实现了推送通知生成.
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)]; }
设备令牌正常生成.但是,当关闭声音和徽章应用程序图标并将警报样式设置为无(设置 – >应用程序名称 – >通知)时,设备令牌不会生成.此问题仅发生在iOS 8设备中.在iOS 7设备中,它正常工作.任何人都可以为此提供解决方案.