Is it possible to remove the push notification from the notification center when one is clicked and the app launches?
Most apps seem to leave the notification in place. I read on another question that this:
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
may work however it doesn't work for me.
The Facebook app definitely seems to remove the push notifications once clicked on.
Pull down your Notification Shade once and then scroll down to the bottom of your notifications. You should now see a History button (Figure 3). The History button has been added to your Notification Shade. Tap History to access your past 24 hours of notifications (Figure 4).
Touch and hold the notification, and then tap Settings . Choose your settings: To turn off all notifications, turn off All notifications. Turn on or off notifications you want to receive.
In Settings, locate “Face ID & Passcode” (for devices with Face ID) or “Touch ID & Passcode” (for devices with a home button) and tap it. Next, enter your passcode. In Passcode settings, locate the “Allow Access When Locked” section. Tap the switch beside “Notification Center” until it is turned off.
To turn off notifications selectively for apps, go to Settings > Notifications > Siri Suggestions, then turn off any app.
int badgeCount = [UIApplication sharedApplication].applicationIconBadgeNumber;
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
[[UIApplication sharedApplication] cancelAllLocalNotifications];
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:badgeCount];
If you add this to both
- (void)applicationWillEnterForeground:(UIApplication *)application
And
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions (NSDictionary *)launchOptions
You will retain the badge count, and clear the push notification when it is clicked in the notification center.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With