Reputation: 49
I am trying to present MFMessageComposeViewController to my view controller having body text and video attachment. It is working fine on iPhone 5 with version 10.3.3 and also on 6s plus with version 11.0.3 but it is showing white blank screen(no body text , no attachment) in iPhone 6s and iPhone 5s with version number 10.3.2. I am posting my code below. Please correct me if my code is not correct.
func shareVideoWithMessage(videoPath : URL, message : String, viewController : UIViewController, completion: @escaping (Bool) -> ()) {
if (MFMessageComposeViewController.canSendText()) {
let controller = MFMessageComposeViewController()
controller.messageComposeDelegate = self
if dictionary.value(forKey: "isCampaign") as! Bool{
controller.body = "Campaign by \(dictionary.value(forKey: "username") as! String) on MyApp. Download the my app: www.google.com"
}
else{
controller.body = "Submission by \(dictionary.value(forKey: "username") as! String) on myApp. Download the My app: www.google.com"
}
var videoData = Data()
do{
videoData = try NSData(contentsOfFile: (videoPath.relativePath), options: NSData.ReadingOptions.alwaysMapped) as Data
}
catch{
completion(false)
}
controller.addAttachmentData(videoData as Data, typeIdentifier: "video/.mp4", filename: "video.mp4")
viewController.present(controller, animated: true, completion: {
completion(true)
})
}
else{
completion(false)
}
}
Upvotes: 2
Views: 353