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

ios7与ios8 注册本地通知

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

// 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://www.xjtudll.cn/Exp/357/

标签: cocoaios
分享给朋友:

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

Keil C51编译错误:address space overflow

Keil C51编译错误:address space overflow

近日在使用Keil的时候,遇到了一个问题:address space overflow。程序最初编译的时候没这问题,当我增加一段代码后,出现了这个问题。经网上搜索,发现根本原因是:data只能是RAM中的前128个,变量超过128个时会出现ADDRESS SPACE OVERFLOW。 &nb...

Android Studio Warning:Not annotated parameter overrides @NonNull parameter

问题: android studio提示:Not annotated parameter overrides @NonNull parameter 分析: Warning:The @NonNull annotation can be used to indicate that a given par...

金蝶 老单增加工具栏按钮(Raise Event)

Public Sub AddToolButton(name As String, Caption As String, Description As String, Optional imagefilename As String = '', Optional iOrder As Long = 47...

C51: LOCATING INITIALIZED VARIABLES AT ABSOLUTE ADDRESSES 如何初始化绝对定址的变量

C51: LOCATING INITIALIZED VARIABLES AT ABSOLUTE ADDRESSES 如何初始化绝对定址的变量

http://www.keil.com/support/docs/301.htm QUESTION 问题描述 I want to locate some initialized constants and variables in memory, but I can't initiali...

Project Serve 2010 Error:Project Server 2010 要求至少使用 Microsoft Internet Explorer 7

Project Serve 2010 Error:Project Server 2010 要求至少使用 Microsoft Internet Explorer 7

安装好project server2010后,提示: Project Server 2010 要求至少使用 Microsoft Internet Explorer 7.0。 如下图所示: 换成IE11,还是提示这个问题,怎么办呢?猜测可能是IE兼容性问题,于是修改兼容性设置 修改完后,问题又来了...

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

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

发表评论

访客

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