2

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

Yung
  • 43
  • 1
  • 7

1 Answers1

2

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.

AtulParmar
  • 4,358
  • 1
  • 24
  • 45
  • 1
    So, for example: If I have 64 notification that I have set to repeat on Sunday. Then on Tuesday I set a new notification that will fire on Thursday it should replace one of the 64 notification right? Since it will be fire the soonest but when I try using getPendingNotificationRequests it still show the 64 notification that was set to fire on Sunday – Yung Dec 10 '18 at 07:34
  • yes perfect, you can set new notification for Tuesday that will fire as you set, it will not affect to Sunday repeating notification. – AtulParmar Dec 10 '18 at 07:38
  • 1
    What I mean is that if I already have 64 recurring notifications set on Sunday. I tried to set new notification that will fire on Tuesday (Today is Monday) it doesn't work. I tried to check my notification with getPendingNotificationRequests and it is not inside but instead all the 64 recurring notifications set on Sunday is still in it. – Yung Dec 10 '18 at 07:42
  • Hi @yung If you set notification trigger repeat true for Monday then it will consider as one notification then you set another notification with repeat true for Tuesday then it has consider as second notification. – AtulParmar Dec 10 '18 at 09:50
  • My problem is similar to this (https://stackoverflow.com/questions/44312909/ios-10-swift-3-add-more-than-64-local-notifications-does-not-keep-soonest) – Yung Dec 12 '18 at 01:45