I have a NotificationContentExtension and want to display the NotificationAttachment in a UIImageView. That works fine but when I extend the push notification (so the NotificationContentExtension loads) it seems like the image is not fully loaded. It has a grey rectangle in the bottom right corner which was not there when I displayed it with the NotificationServiceExtension.
This is the didReceive method in my NotificationContentExtension:
func didReceive(_ notification: UNNotification) {
let content = notification.request.content;
self.name.text = content.title
self.subject.text = content.subtitle
self.body.text = content.body
if let attachment = content.attachments.first {
if attachment.url.startAccessingSecurityScopedResource() {
self.profilePicture.image = UIImage(contentsOfFile: attachment.url.path)
attachment.url.stopAccessingSecurityScopedResource()
}
}
}
Am I doing something wrong?