后台提醒数字(应用程序applicationIcon上的数字)
@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];
应用程序进入后台默认处于休眠状态,这样就无法及时读取未读消息数,那怎么办呢?
在后台开启任务让程序时刻保持运行状态:(能维持运行的时间是不确定的,
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。