iOS8之后,新的注册通知方式,解决注册通知失败问题

来源:互联网 发布:如何做网络直播 编辑:程序博客网 时间:2024/06/02 07:30

最近项目中的推送失效了,首先发现服务器推送服务报错,是推送证书过期,更新了推送证书和描述文件,但是Pad端接受不到远程推送,首先发现服务器没有接收到pad端发送的deviceToken,那肯定就是注册远程通知时出现问题咯,将代码更新为兼容iOS8之后的通知注册方式,成功!!!
AppDelegate.m

if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) {  UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:nil];  [application registerUserNotificationSettings:settings];  [application registerForRemoteNotifications];  }  else {      [[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert|       UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeSound];  }
0 0