I'm working on a MessageExtension app and trying to send transparent images through imessage. However when I add the image to the message, the image loses its background transparency and is filled in with a solid white. is there a way to mitigate this?
For some more context, the user is picking the image from a CollectionView full of cells that contain a UIImageView. I can see in the CollectionView that the images have transparent backgrounds, so I believe it has something to do when adding the image to a message.
this is my code for adding the image to a message:
guard let conversation = activeConversation else{
print("conversation failed")
return
}
let layout = MSMessageTemplateLayout()
layout.image = image
let message = MSMessage()
message.layout = layout
conversation.insert(message) {error in
if let error = error{
print("error sending message: \(String(describing: error))")
}
}
I looked around and a suggestion was to add these two lines of code right before the message is inserted into the conversation, but it did not fix the problem:
// Set the message bubble to transparent
message.shouldExpire = true
message.accessibilityLabel = "Transparent bubble"