In my Notification Service Extension
I am downloading an image from a URL to show as UNNotificationAttachment
in a notification.
So I have this image as UIImage and don't see the need to write it in my app directory / group container on disc just to set up the notification.
Is there a good way create an UNNotificationAttachment
with a UIImage ?
(should be appliable to local and remote notifications)
NSData
representation of theUIImage
into the newly created directoryI wrote an extension on
UINotificationAttachment
So to create
UNUserNotificationRequest
withUNUserNotificationAttachment
from aUIImage
you can simply do sth like thisThis should work since
UNNotificationAttachment
will copy the image file to an own location.