ios推送兼容ios7,8

来源:互联网 发布:网络中级工程师好考吗 编辑:程序博客网 时间:2024/06/06 07:16

ios推送兼容ios7,8

by 伍雪颖

UIApplication *APPLICATION = [UIApplication sharedApplication];// ios 8if ([APPLICATION respondsToSelector:@selector(isRegisteredForRemoteNotifications)]) {    UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIRemoteNotificationTypeBadge|         UIRemoteNotificationTypeSound|         UIRemoteNotificationTypeAlert)categories:nil];    [APPLICATION registerUserNotificationSettings:settings];    [APPLICATION registerForRemoteNotifications];} else { // ios7    [APPLICATION registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge                                                     |UIRemoteNotificationTypeSound                                                     |UIRemoteNotificationTypeAlert)];}


0 0