I am developing an IM application that keeps connection open for some time when application is backgrounded and uses local notifications to alert user about new incoming messages.
Previously, on iOS 4, -[UIApplication cancelAllLocalNotifications]
was called before presenting a new local notification using -[UIApplication presentLocalNotificationNow:]
. This way always only the latest notification was present on the screen.
Since iOS 5 introduced Notification Center, this solution is not acceptable anymore because we want to have more that one last message displayed there. But also we want to close all local notification alerts when application becomes active. How do I better do that? I suppose I should call -[UIApplication cancelAllLocalNotifications]
at some point, but I'm not sure where. Ahy help will be appreciated.