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

ios7与ios8 注册本地通知

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

// 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 注册本地通知” 的相关文章

BOM各层级计算真实用量

BOM各层级计算真实用量

SELECT * FROM ( select 级别='1',A='A1',B='B1',用量='1',B真实用量='' UNION ALL select 级别='2',A='B1',B='C1',用量='2',B真实用量='' UNION ALL select 级别='3',A='C1...

金蝶K3老单原生字段设置必录

修改单据模板ICTemplate里对应的字段 select * from ICTemplate where FCaption like '%部门%' and FID = 'D01' 修改FMustInput字段,改为1,即true,则为必录...

iOS 获取当前正在显示的ViewController

我们在非视图类中想要随时展示一个view时,需要将被展示的view加到当前view的子视图,或用当前view presentViewController,或pushViewContrller,这些操作都需要获取当前正在显示的ViewController。 //获取当前屏幕显示的viewcont...

Quartus II Warning:can't generate programming files because you are currently using the Quartus II softwore in Evaluation Node

开发环境: Quartus II 11.0 问题: 代码编译通过,但是下载到CPLD,没有任何现象 且有warning 如下: can't generate programming files because you are currently using the Quartus II softwo...

K3 wise 老单增加自定义项为下推或上拉【选单条件】

-- 老单增加自定义项选单条件,就是在下推时显示【没有符合条件的记录】,或在下游单据选单时在序时薄界面默认过滤条件单自据,这里以销售订单下推生成发货通知为例-- 步骤如下:-- 1、要用到的数据表有 -- ICTransactionType 该表反映了供需链所有单据的总体情况-- ICCl...

MSP430 fail to initialize device解决

MSP430 fail to initialize device解决

日前,在用MSP430 USB仿真器下载程序的时候,突然提示“fail to initialize device”,碰到这个问题,我的第一反应就是检查下载线与单片机是否连接正确,仔细检查了一遍连线,发现连接无误,但是就是每次都提示“fail to initialize device”,然后无法...

发表评论

访客

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