Yung
Yung

Reputation: 53

Question on how to proceed with UNUserNotificationCenter 64 limit

I am trying to make a reminder app and all my notification repeat is set to true

Example :

var dateComponents = DateComponents()
                dateComponents.weekday = 1
                dateComponents.hour = Int(hour)
                dateComponents.minute = Int(minute)

let trigger = UNCalendarNotificationTrigger(dateMatching: dateComponents, repeats: true)
                    let requestIdentifier = "\(timeArrayToSaveInMobile[indexTime].alarmId!)Sunday"
                    let request = UNNotificationRequest(identifier: requestIdentifier, content: content, trigger: trigger)

I've browse around here and some people mentioned that the system keeps the soonest-firing 64 notifications. So, if I have already reached the limit but I set another notification that will fire earlier than some of the notification in the (64 list) it should replace one of the notification right? Since it will fire earlier that some of the pre-set notification in the list.

My problem is similar to this ios 10 swift 3 add more than 64 local notifications does not keep soonest

Upvotes: 2

Views: 413

Answers (1)

AtulParmar
AtulParmar

Reputation: 4570

Notifications will reset when you open the app, thus you can set/send another 64 after every time you close the application.

The system discards scheduled notifications in excess of this limit, keeping only the 64 notifications that will fire the soonest. Recurring notifications are treated as a single notification.

in your example you have set one notification for Sunday which is only count one for each Sunday.

Upvotes: 2

Related Questions