This is a question for an expert with specialist knowledge.
It is possible to successfully share high quality lossless PNG images with UIActivityViewController to many sharing platforms with the exception of Facebook Messenger which fails every time. The error provided is “Couldn’t Load Content”.
Both UIImagePNGRepresentation NSData and AnyObject fail in Facebook Messenger, UIImage however shares successfully BUT the outputted image appears to be a JPG and is low quality and lossy.
Question:
What’s going on here and how can it be corrected -- how can I successfully share high quality lossless PNG images with UIActivityViewController to Facebook Messenger?
Is this a problem or limitation of Facebook Messenger, Xcode, or UIActivityViewController?
Are there alternatives to NSData and AnyObject (and UIImage) that will work?
Code:
var myImage: UIImage!
var myImagePNG: NSData!
//var myImagePNG: AnyObject!
func sharePNG() { …
myImagePNG = UIImagePNGRepresentation(myImage)!
let activity = UIActivityViewController(activityItems: [myImagePNG], applicationActivities: nil)
self.presentViewController(activity, animated: true, completion: nil)
}
Image:
