I call local Notifications like so
let center = UNUserNotificationCenter.current()
let content = UNMutableNotificationContent()
content.title = title
content.body = text
content.categoryIdentifier = category
content.userInfo = map
content.sound = UNNotificationSound.default()
content.setValue("YES", forKeyPath: "shouldAlwaysAlertWhileAppIsForeground")
let request = UNNotificationRequest(identifier: "testing", content: content, trigger: nil)
center.add(request)
with the same UNNotificationRequest
identifier each time (a non-changing string). According to the docs:
identifier
A unique identifier for the request (if identifier is not unique, a new notification request object is not created). You can use this identifier later to cancel a request that is still pending. This parameter must not be nil.
The local notification fires every time I trigger it, even in the same instance of the app. The identifier is always the same. Are the docs wrong?