Currently trying to open MFMessageComposeViewController
with an image attached but the typeIdentifier
that I have found in older code seems to not be the right fit and I'm not able to find any documentation regarding attaching an image to a message other than copying the image to the PasteBoard/clipboard then having the user manually paste it in the message.
func sendMessageWith(imageData: Data) -> MFMessageComposeViewController? {
if MFMessageComposeViewController.canSendText() == true {
let composeVC = MFMessageComposeViewController()
composeVC.messageComposeDelegate = self
composeVC.addAttachmentData(imageData, typeIdentifier: kUTTypeJPEG, filename: "image.jpg")
print("OK")
return composeVC
}
print("Try Again")
return nil
}