0

I want to clear the local push notifications of the app from the notification center on click of a button which is present inside the app.

Anbu.Karthik
  • 82,064
  • 23
  • 174
  • 143
Subso
  • 1,413
  • 2
  • 10
  • 16

3 Answers3

1

On iOS before 10 you could only achieve that by setting applicationIconBadgeNumber to 0. With iOS 10 you can modify individual notifications using UNUserNotificationCenter framework.

pronebird
  • 12,068
  • 5
  • 54
  • 82
0

please use this code it will be help you out

 [[UIApplication sharedApplication] setApplicationIconBadgeNumber:1];
 [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];

 // To remove the notifications in Notification Center:
 [[UIApplication sharedApplication] cancelAllLocalNotifications];
Ajharudeen khan
  • 246
  • 2
  • 10
-1

Try this

int badgeCount = [UIApplication sharedApplication].applicationIconBadgeNumber;
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
[[UIApplication sharedApplication] cancelAllLocalNotifications];
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:badgeCount];
RrrangeTop
  • 312
  • 1
  • 10