目标c如何在录制一个通知后在通知托盘上保留其他通知

时间:2023-01-07 15:03:22

For my iOS application, I've received local notifications its working fine.

对于我的iOS应用程序,我收到了本地通知,其工作正常。

When the app is in Background, these notifications go to Notification Tray, stay there until I see those notifications.

当应用程序处于后台时,这些通知将转到通知托盘,保持不变直到我看到这些通知。

But here i have issue as follows,

但在这里我有如下问题,

At 6.00AM I have received 5 local notifications, all these 5 are staying under notification tray... But when I tap any one of these 5 all the other 4 notifications (notification of my project) under Notification Tray are also cleared.

在早上6点,我收到了5个本地通知,所有这5个都在通知托盘下...但是当我点击这5个中的任何一个时,通知托盘下的所有其他4个通知(我的项目的通知)也被清除。

I don't have any clue on what it does...

我对它的作用一无所知......

What I need to do to keep the other notification in Tray only?

我需要做什么才能将其他通知仅保留在托盘中?

My code in

我的代码在

- (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;
}

2 个解决方案

#1


1  

application.applicationIconBadgeNumber = 0;

has side effect.You should set it properly.

有副作用。你应该正确设置它。

#2


1  

In notification tray, if you tap on any notification, other notifications of the same app will automatically cleared from the tray. This is the default behaviour of iOS, you can't change it.

在通知托盘中,如果您点击任何通知,则同一应用程序的其他通知将自动从托盘中清除。这是iOS的默认行为,您无法更改它。

#1


1  

application.applicationIconBadgeNumber = 0;

has side effect.You should set it properly.

有副作用。你应该正确设置它。

#2


1  

In notification tray, if you tap on any notification, other notifications of the same app will automatically cleared from the tray. This is the default behaviour of iOS, you can't change it.

在通知托盘中,如果您点击任何通知,则同一应用程序的其他通知将自动从托盘中清除。这是iOS的默认行为,您无法更改它。