MFMessageComposeViewController在某些设备上显示空白屏幕

时间:2017-11-14 11:55:07

标签: ios swift xcode8 mfmessagecomposeview

我正在尝试将MFMessageComposeViewController呈现给具有正文和视频附件的视图控制器。它在iPhone 5上运行良好,版本10.3.3以及6s plus版本11.0.3但它在iPhone 6s和版本号为10.3.2的iPhone 5s中显示白色空白屏幕(没有正文,没有附件)。我在下面发布我的代码。如果我的代码不正确,请纠正我。

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)

    }

}

0 个答案:

没有答案