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.
Asked
Active
Viewed 1,107 times
0
-
What do you mean? Push notifications? Apple Notification center didn't store they. – Igor Jul 12 '16 at 10:41
-
is it remote notificaiton or local one ? – Pranav Jul 12 '16 at 10:41
-
local push notifications. – Subso Jul 12 '16 at 10:43
-
do you want clear all local LocalNotifications ? – balkaran singh Jul 12 '16 at 10:43
-
only the one which are linked to my app. – Subso Jul 12 '16 at 10:46
3 Answers
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