Image from attachment from Local notification is not shown in UNNotificationContentExtension
<p>I've been working on rich notification experience which has been introduced in iOS10 and stuck with passing images as attachments to <code>UNNotificationContentExtension</code>.</p>

<p>Here's my ContentExtension:</p>

<pre><code>class NotificationViewController: UIViewController, UNNotificationContentExtension {

    @IBOutlet weak var attachmentImage: UIImageView!

    func didReceive(_ notification: UNNotification) {

        if let attachment = notification.request.content.attachments.first {
            if attachment.url.startAccessingSecurityScopedResource() {
                attachmentImage.image = UIImage(contentsOfFile: attachment.url.path)
                attachment.url.stopAccessingSecurityScopedResource()
            }
        }
    }
}
</code></pre>

<p>As a tutorial, I've been following <a href="https://developer.apple.com/videos/play/wwdc2016/708/" rel="noreferrer">Advanced Notifications video from WWDC</a>.
I've checked - <code>UIImage</code> I'm assigning to UIImageView:</p>

<ul>
<li>is <em>not</em> <code>nil</code></li>
<li>has proper <code>CGSize</code> (191x191)</li>
<li>attachment.url.path equals  <code>/var/mobile/Library/SpringBoard/PushStore/Attachments/&lt;bundle of app&gt;/&lt;...&gt;.png</code></li>
</ul>

<p><strong>Here's how I send local notification from the app</strong>:</p>

<pre><code>    let content = UNMutableNotificationContent()
    content.title = "Sample title"
    content.body = "Sample body"
    content.categoryIdentifier = "myNotificationCategory"

    let attachement = try! UNNotificationAttachment(identifier: "image",
                                                                url: Bundle.main.url(forResource: "cat", withExtension: "png")!,
                                                                options: nil)

    content.attachments = [ attachement ]

    let request = UNNotificationRequest(identifier:requestIdentifier, content: content, trigger: nil)
    UNUserNotificationCenter.current().delegate = self
    UNUserNotificationCenter.current().add(request){(error) in
        if (error != nil){
        }
    }
</code></pre>

<p>"cat.png" is just a dummy resource I've added to proj.
<a href="https://i.stack.imgur.com/6pzEv.png" rel="noreferrer"><img src="https://i.stack.imgur.com/6pzEv.png" alt="enter image description here"></a></p>

<p>As you can see, notification shows the pic, so I assume, that I'm sending it correctly, but in the expanded state(in <code>NotificationViewController</code>)  I've never succeed at showing the same image.</p>

<p>What am I doing wrong?
Thanks!</p>