Attention: Application ID changes with every Appstart since iOS 8

do {
    let documentsURL = try FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false)
    let docs = try FileManager.default.contentsOfDirectory(at: documentsURL, includingPropertiesForKeys: [], options:  [.skipsHiddenFiles, .skipsSubdirectoryDescendants])
    let images = docs.filter{ $0.pathExtension == "xxx" }
    print(images)
} catch {
    print(error)
}
    //Delete Image from Notification
    if lentItems.imageURL == nil {
        //no image to delete
    } else {
        let fileManager = FileManager.default
        do {
            try fileManager.removeItem(atPath: lentItems.imageURL!)
        } catch {
            print("Could not delete Image: \(error)")
        }
    }
    do {
        let attachment = try UNNotificationAttachment(identifier: "bild", url: imageURL, options: nil)
        content.attachments = [attachment ]
    } catch {
        print("Attachment could not be loaded" )
    }
    // Create a URL
    let documentsURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first
    let imageURL = documentsURL?.appendingPathComponent("\(String(describing: title)).png")


    // save image to URL
    if thumbnailData == nil {
        print("No Picture")
    } else {
        let notificationImage = UIImage(data: thumbnailData as! Data) // or wherever you have your UIImage
        do {
            try UIImagePNGRepresentation(notificationImage!)?.write(to: notificationImageURL!)                    
        } catch {
            print("Couldnt save image" )
        }
    }