//不在appIcon上显示推送数量,但是在系统通知栏保留推送通知的方法
define IS_IOS11_LATER ([[UIDevice currentDevice] deviceSystemMajorVersion] >= 11)
-(void)resetBageNumber{
if(IS_IOS11_LATER){
/*
iOS 11后,直接设置badgeNumber = -1就生效了
*/
[UIApplication sharedApplication].applicationIconBadgeNumber = -1;
}else{
UILocalNotification *clearEpisodeNotification = [[UILocalNotification alloc] init];
clearEpisodeNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:(0.3)];
clearEpisodeNotification.timeZone = [NSTimeZone defaultTimeZone];
clearEpisodeNotification.applicationIconBadgeNumber = -1;
[[UIApplication sharedApplication] scheduleLocalNotification:clearEpisodeNotification];
}
网友评论