Http://stackoverflow.com/questions/8682051/ios-application-how-to-clear-notifications
| Up vote105down vote |
Just to expand on Pcperini ' s answer. As he mentions you'll need to add the following code to your application:didFinishLaunchingWithOptions: method; [[UIApplication sharedApplication] setApplicationIconBadgeNumber: 0];[[UIApplication sharedApplication] cancelAllLocalNotifications];
You Also need to increment then decrement the badge in your application:didReceiveRemoteNotification: method if you is trying to clear the message F ROM the message centre so then a user enters you app from pressing a notification the message centre would also clear, Key [[UIApplication sharedApplication] setApplicationIconBadgeNumber: 1];[[UIApplication sharedApplication] setApplicationIconBadgeNumber: 0];[[UIApplication sharedApplication] cancelAllLocalNotifications];
|
IOS Application:how to clear notifications?