iOS8注册推送

来源:互联网 发布:c语言温度转换怎么写 编辑:程序博客网 时间:2024/05/16 12:29
Apple在9月18日正式发布了iOS8,在收到更新的同时,也发现自己的应用在iOS8下无法启动。 

并且在Console中收到如下提示:registerForRemoteNotificationTypes: is not supported in iOS 8.0and later.

解决方案:需兼容iOS7和iOS8的注册推送

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


0 0
原创粉丝点击