码迷,mamicode.com
首页 > 移动开发 > 详细

后台提醒数字(应用程序applicationIcon上的数字)

时间:2015-06-05 15:13:36      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:

技术分享@property(nonatomic) NSInteger applicationIconBadgeNumber;  // set to 0 to hide. default is 0. In iOS 8.0 and later, your application must register for user notifications using -[UIApplication registerUserNotificationSettings:] before being able to set the icon badge.

 

发现8.0以后,要先写-[UIApplication registerUserNotificationSettings:]这个方法

 

于是:

 [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeBadge categories:nil]];

        [UIApplication sharedApplication].applicationIconBadgeNumber = [responseObject[@"status"] intValue];

 

应用程序进入后台默认处于休眠状态,这样就无法及时读取未读消息数,那怎么办呢?

 

在后台开启任务让程序时刻保持运行状态:(能维持运行的时间是不确定的,

后台提醒数字(应用程序applicationIcon上的数字)

标签:

原文地址:http://www.cnblogs.com/yintingting/p/4554412.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!