first I'd like to say that I've been searching for the answer to my question quite a bit but the only things I've found so far are answers for older versions of Swift or answers that don't specifically answer my question.
Background info:
I'm trying to develop an app that can remind you in a set interval. Now this works, given that you only set 1 reminder. However if I set the interval to be 20 seconds, launch the app, set 2 notifications and close the app only the second notification shows in 20 seconds. The first notification is being overwritten by the second one.
Question: How can I make sure that all of my notifications, requested by the user, actually get sent and that no notification overrides the previous one?
Code for the notification:
let tijd = 20 //20 is just for the test, normally there is more code to it
// Notification
let content = UNMutableNotificationContent()
content.title = "Notification title"//title
content.body = "Notification body" //body
content.badge = 1
content.sound = UNNotificationSound.default()
// Timer
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: TimeInterval(tijd), repeats: false)
let request = UNNotificationRequest(identifier: "timerDone", content: content, trigger: trigger)
UNUserNotificationCenter.current().add(request, withCompletionHandler: nil)