Hello - I have a working app with local notifications setting an identifier and updating a previous notification.
let center = UNUserNotificationCenter.current()
let content = UNMutableNotificationContent()
content.title = "Updating Notification"
content.body = "Updated Body Content"
let requestIdentifier = "update.this.notification" // Set an identifier value
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 5, repeats: false)
let request = UNNotificationRequest(identifier: requestIdentifier, content: content, trigger: trigger) // Pass identifier to the request
center.add(request) {(error) in print(error?.description)}
I also have a working UNNotificationServiceExtension that accepts a remote push and modifies its content before displaying to the user. Howevier I'm struggling to figure out how to set the identifier value from within the UNNotificationServiceExtension. The UNNotificationRequest object has a get-only identifier property.
In order to update a notification on a subsequent push you must set the apns-collapse-id value in the header using APNS HTTP/2. Not all push libraries have been updated for this and the library I was using did not have support for it. I added support and hopefully it will be merged in shortly to the Ruby Apnotic gem. https://github.com/ostinelli/apnotic/pull/19
This is now supported in the ruby apnotic gem. https://github.com/ostinelli/apnotic
Thanks to mungbeans for pointing me to the apns-collapse-id.