如果用户将警报样式设置为横幅。他们可以收到超过1个通知,而不会提示他们清除它。他们然后去使用他们的电话,他们说有3个存储。如果点击最新的一个&它打开应用程序,我只想清除只是这一个通知,我也需要去badgeCount--;
如何清除iOS中的通知
我怎样才能实现它与下面的代码? (目前它被设置为清除所有我不想要的东西......)我也注意到有时它会更新徽章号码。但如果我切换回iOS主屏幕,并拉下通知菜单,它仍然存在!
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
if([[userInfo valueForKey:@"aps"] valueForKey:@"alert"] != nil) {
NSString *message = [[userInfo valueForKey:@"aps"] valueForKey:@"alert"];
if(message != nil) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Usage Alert"
message:message delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Ok", nil];
[alertView show];
[[UIApplication sharedApplication] setApplicationIconBadgeNumber: 0];
[[UIApplication sharedApplication] cancelAllLocalNotifications];
}
}
}
http://stackoverflow.com/questions/17107957/how-to-clear-a-single-通知 - 从-A-列表中的通知上单击 – SWT 2013-06-14 13:10:14