总结自己所遇到的开发知识,相互借鉴~
if ([UIDevice currentDevice].systemVersion.doubleValue < 8.0) {
// 不是iOS8
UIRemoteNotificationType type = UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert;
// 当用户第一次启动程序时就获取deviceToke
// 该方法在iOS8以及过期了
// 只要调用该方法, 系统就会自动发送UDID和当前程序的Bunle ID到苹果的APNs服务器
[application registerForRemoteNotificationTypes:type];
}else
{
// iOS8
UIUserNotificationType type = UIUserNotificationTypeBadge | UIUserNotificationTypeAlert | UIUserNotificationTypeSound;
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:type categories:nil];
// 注册通知类型
[application registerUserNotificationSettings:settings];
// 申请试用通知
[application registerForRemoteNotifications];
}