Questions tagged [unnotificationattachment]
27 questions
22
votes
4 answers
UNNotificationAttachment with UIImage or Remote URL
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…

MarkHim
- 5,686
- 5
- 32
- 64
14
votes
2 answers
Image from attachment from Local notification is not shown in UNNotificationContentExtension
I've been working on rich notification experience which has been introduced in iOS10 and stuck with passing images as attachments to UNNotificationContentExtension.
Here's my ContentExtension:
class NotificationViewController: UIViewController,…

Konstantin Loginov
- 15,802
- 5
- 58
- 95
11
votes
4 answers
UNNotificationAttachment failing to attach image
So the following code is being used to attach an image from local storage url of an image. I check in Terminal to see if the image is stored and it does store the image without any issues. So ruling out any issues with the url itself.
do {
let…

as diu
- 1,010
- 15
- 31
8
votes
1 answer
When attaching thumbnails to notifications, where does the file go?
I am adding a thumbnail to a rich notification. I generate the image to be used as an attachment like this:
let url = URL(fileURLWithPath: NSTemporaryDirectory(), isDirectory: true)
let fileURL = url.appendingPathComponent("someImageName",…

Sti
- 8,275
- 9
- 62
- 124
5
votes
1 answer
Error __NSCFLocalDownloadFile error 2 creating temp
NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
@synchronized (session)
{
[[session downloadTaskWithURL:attachmentURL
completionHandler:^(NSURL…

Mathi Arasan
- 869
- 2
- 10
- 32
4
votes
1 answer
Rich notification with expanded image in notification tray
I'm trying to display rich notifications on my app with an expanded image like this. I have used Notification Service extension to implement this in the app.
But I'm only getting a thumbnail when I receive a notification, which looks something…

ebby94
- 3,131
- 2
- 23
- 31
4
votes
1 answer
Download larger images in UNNotificationServiceExtension
I'm using the UNNotificationServiceExtension to create rich notifications on iOS 10 with an image attachment. Everything works fine with smaller images except when the image to download is a bit larger (e.g. 7MB).
In this case, the download starts…

Jan
- 7,444
- 9
- 50
- 74
4
votes
1 answer
Why is UNNotificationContent's attachments property an NSArray (vs a single UNNotificationAttachment)?
Why is the attachments property for UNNotificationContent an array as opposed to a single UNNotificationAttachment? It appears that only the first attachment is used as a preview in Notification Center...
Are additional attachments only useful as a…

William LeGate
- 540
- 7
- 18
3
votes
0 answers
UNNotificationAttachment is not working on iOS 14
I implemented UNNotificationServiceExtension to attach image thumbnail on push notification. (By using UNNotificationAttachment).
It works really well on iOS 13. But after updating to iOS 14, it is not working though.
There is no thumbnail image on…

Paul
- 759
- 2
- 7
- 20
3
votes
0 answers
iOS 10 notification extension: can I change the action button text?
I've been playing around a little with the UNNotificationContentExtension framework to display a custom view inside a notification. So far, so good - got it rendering, and then altering content when a user taps on an action button.
But the one thing…

Alastair
- 5,894
- 7
- 34
- 61
2
votes
3 answers
UNNotificationAttachment set image URL to Caches directory
I have Image cache mechanism in my app. I also need to show local notifications with images. I have a problem. When I try to set UNNotificationAttachment with an image, I get an image from my cache or, if an image doesn't exist, I download it and…

Valentin Shamardin
- 3,569
- 4
- 34
- 51
2
votes
2 answers
get the URL for NSData saved in CoreData
I'm saving a UIImage to Core Data. So first, I convert it to NSData, then save it.
I need to get the URL for the image after it's saved. I'm doing this because I want to schedule a local notification with an attachment, and the only way to do it,…

Ennabah
- 2,303
- 2
- 20
- 39
1
vote
1 answer
Unable to access Files, because there is no such file or directory
Good Day.
I receive a message with an image URL. Whenever I receive the image URL I have to show it through local notification. Like this
However, I use UNNotificationAttachment
convenience init(identifier: String,
url URL: URL,
…

Ankur Lahiry
- 2,253
- 1
- 15
- 25
1
vote
1 answer
Path to file(image) in Notification Service Extension folder
I am trying to add a local image(icon) as an attachment to a remote notification on iOS 12. In other words the image URL is not passed in the notification userInfo but is determined internally based on other criteria in userInfo. Therefore I want a…

supernova
- 88
- 7
1
vote
1 answer
Objective-C initialization method returned nil while initializing UNNotificationAttachment class in Libgdx
I am trying attach image to notification in iOS module of Libgdx project. But while initializing UNNotificationAttachment i am getting following error
2020-08-26 08:09:56.711 IOSLauncher[29001:1089461] -[NSURL init] called; this results in an NSURL…

Amar Maharjan
- 220
- 4
- 12