I'm working on a MessageExtension app and trying to send an images with a transparent background 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, and also when I run the program with a breakpoint and view the active variables the image has a transparent background. 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 //image is a UIImage
let message = MSMessage()
message.layout = layout
conversation.insert(message) {error in
if let error = error{
print("error sending message: \(String(describing: error))")
}
}