Objective c 如何在点击一个通知后将其他通知保留在通知托盘上
Objective c how to keep other notifications on the notification tray after taping one notification
对于我的 iOS 申请,
我已经收到本地通知,它工作正常。
当应用程序处于后台时,这些通知会转到通知托盘,留在那里直到我看到这些通知。
但是我有如下问题,
早上 6 点我收到了 5 个本地通知,所有这 5 个都在通知托盘下...但是 当我点击这 5 个中的任何一个时,所有其他 4 个通知(我的项目通知) 通知托盘下也被清除。
我不知道它的作用...
我需要做什么才能将其他通知仅保留在任务栏中?
我的代码在
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
{
NotificationAlertView * localNotificationAlert = [[NotificationAlertView alloc] initWithTitle:APP_TITLE message:notification.alertBody delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
localNotificationAlert.notifcation = notification ;
localNotificationAlert.tag =ALERT_SURVEY_NOTIFICATION_TAG;
[localNotificationAlert show];
application.applicationIconBadgeNumber = 0;
// Set icon badge number to zero
application.applicationIconBadgeNumber = 0;
notification.applicationIconBadgeNumber = 0;
}
在通知托盘中,如果您点击任何通知,同一应用的其他通知将自动从托盘中清除。
这是 iOS 的默认行为,您无法更改它。
application.applicationIconBadgeNumber = 0;
有边effect.You应该正确设置。
对于我的 iOS 申请, 我已经收到本地通知,它工作正常。
当应用程序处于后台时,这些通知会转到通知托盘,留在那里直到我看到这些通知。
但是我有如下问题,
早上 6 点我收到了 5 个本地通知,所有这 5 个都在通知托盘下...但是 当我点击这 5 个中的任何一个时,所有其他 4 个通知(我的项目通知) 通知托盘下也被清除。
我不知道它的作用...
我需要做什么才能将其他通知仅保留在任务栏中?
我的代码在
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
{
NotificationAlertView * localNotificationAlert = [[NotificationAlertView alloc] initWithTitle:APP_TITLE message:notification.alertBody delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
localNotificationAlert.notifcation = notification ;
localNotificationAlert.tag =ALERT_SURVEY_NOTIFICATION_TAG;
[localNotificationAlert show];
application.applicationIconBadgeNumber = 0;
// Set icon badge number to zero
application.applicationIconBadgeNumber = 0;
notification.applicationIconBadgeNumber = 0;
}
在通知托盘中,如果您点击任何通知,同一应用的其他通知将自动从托盘中清除。 这是 iOS 的默认行为,您无法更改它。
application.applicationIconBadgeNumber = 0;
有边effect.You应该正确设置。