如果遇到 badge 的值一直在累加那么久需要调用极光的方法去重置:
- (void)applicationWillEnterForeground:(UIApplication *)application {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
[UIApplication sharedApplication].applicationIconBadgeNumber = 0;
[[UNUserNotificationCenter alloc] removeAllPendingNotificationRequests];
[[UIApplication sharedApplication] cancelAllLocalNotifications];
[JPUSHService resetBadge];
}
网友评论