ShareExtension suggestions loosing avatars after a while

Hello, I am developing a Chat application, and I was able to successfully implement INSendMessageIntent to be able to have suggestions in Share Extensions with some of my contacts.

I've noticed that after a day or two, avatars are lost, and 2 tested devices are displaying empty background.

When I use my app to send a message, this new chat appears with avatar properly, but just after some time it goes away.

I am using:

let avatarImage = INImage(url: avatarUrl)
intent.setImage(avatarImage, forParameterNamed: \.speakableGroupName)

where avatarUrl can be a file created in NSTemporaryDirectory or just a file in my shared AppGroup directory.

As you can see, Telegram suggestions work fine, suggestions from my app works well as well when I donate the intent, but after some time avatars just goes away

Does apple perform some avatar caching, so when I donate the intent avatars are stored for Share sheet somewhere? Or they always use my local url and I need to make sure it's not deleted?

Fixed it by myself, leaving it here for other people, and maybe for Apple team to sort out this issue.

Instead of using:

INImage(url: avatarUrl)

I am using

INImage(imageData: avatarData)

Originally my avatarUrl was pointing to documentsDirectory, also tried to use FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroupIdentifier), but all those resulted in avatars being gone after iPhone restart.

Using BinaryData fixes the issue

ShareExtension suggestions loosing avatars after a while
 
 
Q