Is there a way to programmatically remove/dismiss UILocalNotification from Notification Tray.
I am able to cancel the notification which removes the notificatio
I was fiddling with some code and I was wondering why local notifications are stored in the notification center if the application is in the foreground. It's probably because Apple doesn't know what you are doing with them and honestly doesn't care; so they do their job.
As far as the question is concerned, I do the following:
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
{
if (application.applicationState == UIApplicationStateActive)
{
NSLog(@"active");
// display some foreground notification;
[application cancelLocalNotification:notification];
}
else
{
NSLog(@"inactive");
}
}