当前位置:首页 > 技术心得 > 正文内容

ios7与ios8 注册本地通知

xjtudll11年前 (2015-05-12)技术心得7900

// IOS8 新系统需要使用新的代码

   if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) 

   { 

       [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings 

                                                                            settingsForTypes:(UIUserNotificationTypeSound |UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) 

                                                                            categories:nil]]; 

       [[UIApplication sharedApplication] registerForRemoteNotifications]; 

   } 

   else 

   { 

       //ios7注册推送通知 

       [[UIApplication sharedApplication] registerForRemoteNotificationTypes: 

        (UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)]; 

   } 

扫描二维码推送至手机访问。

版权声明:本文由鸟的天空发布,如需转载请注明出处。

本文链接:http://xjtudll.cn/Exp/357/

标签: cocoaios
分享给朋友:

“ios7与ios8 注册本地通知” 的相关文章

聚合物电池的容量如何计算

参考资料: http://www.18650.com.cn/news/15373393.html 1、测量开路电压 电池端电压和剩余容量之间有一个确定的关系,测量电池端电压即可估算其剩余容量。 这种方法的局限是: 1)对于不同厂商生产的电池,其开路电压与容量之间的关系各不相同。 2)只有通过测...

Android error:Duplicate ID, tag null, or parent id with another fragment(fragment嵌套问题)

参考资料:http://stackoverflow.com/questions/14083950/duplicate-id-tag-null-or-parent-id-with-another-fragment-for-com-google-androi 跟参考资料里的这个人一样,我也碰到了这个...

“格林尼治时间”或将退休 明年全球将投票表决

          http://china.nfdaily.cn/content/2011-11/10/content_32922220.htm      &...

MultiSelectListPreference 由于xml存在问题而崩溃

参考资料: http://stackoverflow.com/questions/28687681/multiselectlistpreference-crashes-with-dependency 问题描述: 添加了一个MultiSelectListPreference,然后一运行程序,就崩溃了。...

CorelDraw12启动时图标一闪而过

现象: Coreldraw12启动时,图标一闪而过,无法打开cdr文件。每次启动都如此。 之前一直是可以使用的,在某次强制关机后,就发现软件不能使用了。 临时解决办法: 网上说的各种方法都试过了,都不行。目前只探索出了两种临时可行的办法。 方法一:每次使用coreldraw12前卸载c...

浅析电波表——英国MSF码

浅析电波表——英国MSF码

参考文献: http://en.wikipedia.org/wiki/Time_from_NPL http://www.npl.co.uk/science-technology/time-frequency/time/products-and-services/msf-radio-time-sig...

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。