Is Apple's docs for UNNotificationRequest's identifier wrong?

75 Views Asked by At

As for the identifier the documentation says:

A unique identifier for the request (if identifier is not unique, notifications are not delivered). You can use this identifier later to cancel a request that is still pending. This parameter must not be nil.

It's says it's not delivered. However according to here and according to my own verification it does get delivered, but it rewrites the previous notification sent with that identifier.

So I'm guessing the apple documentation should have said:

if identifier is same, it will only update the previous sent notification. If you want a separate notification, you must change its identifier.

Am I right about the documentation being wrote in a confusing way?

1

There are 1 best solutions below

2
Tushar Sharma On
let request = UNNotificationRequest(identifier: "textNotification", content: content, trigger: trigger)

This is the request that makes notification trigger with identifier as you can see.So indeed yes notifications do require an identifier,providing same identifier and not keeping unique will only let you trigger one notification at a time(Which is the latest one you schedule)ignoring any other you scheduled . But in order to get multiple notification one after another or some other time yes you require unique identifier.That is what i understand behind concept of unique identifier.