I'm trying to write a program that when you tap an image stored in the app, it opens up an iMessage with the image in the body ready to send. It is working except that the image appears in the text as a file with a name that you can open with Dropbox or some similar app. Is there a way to actually have the image be in the text, like when you text a photo from your library? Here is the code for my Message:
func launchMessageComposeViewController(image: UIImage) {
if MFMessageComposeViewController.canSendText() {
let messageVC = MFMessageComposeViewController()
messageVC.messageComposeDelegate = self
var imageData = UIImagePNGRepresentation(image)
messageVC.addAttachmentData(imageData!, typeIdentifier: "png", filename: "pic")
self.presentViewController(messageVC, animated: true, completion: nil)
}
else {
print("User hasn't setup Messages.app")
}
}
Thanks!