Limit amount of notifications to display in Notification Center

Hi everyone.
Hope all doing well!
I have an issue when working with notification.
The requirement is display limit around 10 messages on Notification Center when receive remote notification, but I can’t find any solutions for this requirement.

Hi and welcome to the forum community @tringuyen623! I personally have not attempted this specific requirement but I’m guessing you might not be able to prevent a notifcation from appearing if the app is not running or in the background. However if the app is active I would check out the property list key - com.apple.developer.usernotifications.filtering which enables “receiving notifications without displaying the notification to the user.” Or trying out willPresent with the method userNotificationCenter(_:willPresent:withCompletionHandler:) to determine what to do with the notifications that go over the limit. Good luck and have a great weekend.

Best,
Gina

thank for your answer.
But the requirement like this: When we have 10 messages displayed on Notification Center. when we receive new one, the last message in Notification Center will be remove, just show 10 messages. I can handle that in the foreground but when app not running/in the background I can’t

This topic was automatically closed after 166 days. New replies are no longer allowed.