Strange behavior when scheduling multiple local notification with copies of an identical image attachment

If I schedule for example three local notifications and attach three different copies of the same image (copies are done before scheduling). Then if user in the notification center selects "Clear" on the first notification, then the next two notifications will be missing the attached image (although it was handed different copies of the same image).

I already know that when scheduling a local notification with an image, iOS will either copy or move the supplied image (depending on file location) to some temp storage it uses for local notifications. So I make sure to first take individual copies of the image and then hand them to the local notification.

I did find an ugly workaround to this problem that works. That for each copy of the image I slightly modify the image size and jpg compression of that identical image, then it doesn't happen.

It's like iOS image duplicate detection logic is activated for local notifications, and I'm fighting some "hash", business-logic or machine learning evaluation if the images are duplicates and should be removed for all attachments when clearing notification (or the folder of the attachments). Which seems wrong.

Bonus info: I even tried that if I only changed jpeg compression slightly on a small picture (200x200) then it could still happen, but if I then at the same time changed the image size by 1 pixel it would be fine. I also tired changing the same small image by 1pixel without compression then the problem happened.. So it feels like it's not a hash of the image (like MD5) but rather some logic or machine learning evaluation.

I have on my to-do to try a one color image to see if that triggers the problem no matter size and compression, just for my curiosity.

Experienced on iOS 15.6+ and 16+

Strange behavior when scheduling multiple local notification with copies of an identical image attachment
 
 
Q