Setting applicationIconBadgeNumber to 0 should not clear Notification Center
Originator: | amousa | ||
Number: | rdar://32972838 | Date Originated: | 25/6/2017 |
Status: | Open | Resolved: | |
Product: | iOS | Product Version: | 3.0+ |
Classification: | Suggestion | Reproducible: | YES |
Notifications Summary: Setting UIApplication's badge value to 0 directly or using remote notifications clears all notifications from Notification Center. Clearing Notification Center should be a separate API without this side-effect. This is very problematic for applications where users can receive multiple notifications outside of the app and want to be able to act on them independently. You can set it to -1 using a local notification to avoid this but setting the badge to -1 or 0 via a remote notification (or by setting applicationIconBadgeNumber) always removes any notifications corresponding to the receiving app from Notification Center. Steps to Reproduce: 1. Send remote visible notifications (i.e. where the "alert" key is present) to your device. Note that appear in Notification Center. 2. Send a silent (badge only) remote notification with a badge count of 0. Expected Results: Notifications in Notification Center are not cleared Observed Results: Notifications in Notification Center corresponding to the app receiving notifications are removed Version: 3.0+ Notes: Would you consider changing this behavior? The UserNotifications framework already provides a way to do this via UNUserNotificationCenter.removeAllDeliveredNotifications(). And maybe a new flag could be supported in the payload to allow the same for remote notifications. Please and thank you!
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
The title is a bit misleading in retrospect. My expectation+hope is setting the badge to 0 would not clear items in Notification Center regardless of how the badge is set (local, remote, or directly via applicationIconBadgeNumber).