Vincent Bacalso
Vincent Bacalso

Reputation: 2147

Swift: Multiple local notifications but only show latest

I wanted to show a local notification at certain times of the day, and I should only be able to see (one) the latest notification in the notification center,

however my problem is:

(1) If i have set the local notifications to different identifiers, I get multiple notifications (which is expected, but not what I want)

(2) If i have one identifier and set it to all times, i get notified only on the last trigger time that i set, cause the other schedules were overridden

So, is it possible to get notified at specific times, and at the same time be able to see only the latest notification?

Thanks

Upvotes: 6

Views: 1217

Answers (1)

Mikrasya
Mikrasya

Reputation: 1140

I don't think it is possible. Unique identifier is useful if you want to modify or delete specific notification at a later time. If you use the same identifier, only the latest scheduled notification will fire.

If you could do multiple notifications and only show the latest one, that could be abused to schedule multiple back-to-back notifications to schedule a long audio playback.

Upvotes: 2

Related Questions