To clear notifications in IOS using objective-c you can use the snippet below.

Sample Objective-C

//in method: application:didFinishLaunchingWithOptions
[[UIApplication sharedApplication] setApplicationIconBadgeNumber: 0];
[[UIApplication sharedApplication] cancelAllLocalNotifications];

//in method: application:didReceiveRemoteNotification
[[UIApplication sharedApplication] setApplicationIconBadgeNumber: 1]; //we need to to increment first
[[UIApplication sharedApplication] setApplicationIconBadgeNumber: 0];
[[UIApplication sharedApplication] cancelAllLocalNotifications];

4 thought on “How to clear notifications in IOS using Objective-C”

Leave a Reply