Limit for local notifications (UNNotificationRequest) in iOS 10

I know that the limit for local notifications is 64 for UILocalNotification . It is written in Apple Dev Docs . But UILocalNotification is deprecated in iOS 10. Instead, Apple suggests using UNNotificationRequest . But Apple Dev Docs says nothing about limiting the number of notifications. I found this answer , but there are no references to Apple Dev Docs or anything like that (this is just an opinion). Does anyone know for sure about local notification restrictions? Maybe someone knows the link to Dev Docs or is there an official answer from Apple about this?

+8
source share
3 answers

Although this is not officially documented, testing shows that UNNotificationRequest retains a limit of 64 notifications.

However, importantly, the way they work with the notification queue has changed. If there are more than 64 notifications:

  • UILocalNotification will store 64 speedy notifications
  • UNNotificationRequest stores the last 64 sets of notifications

This may be a mistake and is documented on this radar .

+3
source

Yes, I just checked iOS 10.2, and the limit on the total number of UNNotificationRequest you can add is still 64.

+2
source

The version of UNNotificationCenter.h for IOS 12 contains in the comments (void)addNotificationRequest:(UNNotificationRequest *)request withCompletionHandler:(nullable void(^)(NSError *__nullable error))completionHandler; following:

Notification requests can be scheduled to notify the user through time and location. See UNNotificationTrigger for more information. Calling -addNotificationRequest: replaces an existing notification request with the same identifier. A notification request with an identifier as existing delivered notification will warn you of a new notification request and will replace the existing delivered notification when it starts. The number of pending notification requests that the application can schedule at any time is limited by the system .

+2
source

Source: https://habr.com/ru/post/1266755/


All Articles