iOS dev
iOS dev

Reputation: 2284

Objective c how to keep other notifications on the notification tray after taping one notification

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

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.

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

Upvotes: 2

Views: 458

Answers (2)

Lumialxk
Lumialxk

Reputation: 6379

application.applicationIconBadgeNumber = 0;

has side effect.You should set it properly.

Upvotes: 1

Hitendra Solanki
Hitendra Solanki

Reputation: 4941

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.

Upvotes: 1

Related Questions