【发布时间】:2017-08-07 07:18:33
【问题描述】:
MFMailComposeViewController 在按下取消或发送按钮后无法关闭。我在课堂上添加了MFMailComposeViewControllerDelegate,但它仍然不起作用?
这是我的代码:
func sendEmail() {
let MailVC = MFMailComposeViewController()
MailVC.mailComposeDelegate = self
MailVC.setToRecipients(["\(emailLabel?.text)"])
MailVC.setSubject("Set your subject here!")
MailVC.setMessageBody("Hello this is my message body!", isHTML: false)
// Present the view controller modally.
self.present(MailVC, animated: true, completion: nil)
}
func mailComposeController(controller: MFMailComposeViewController,
didFinishWithResult result: MFMailComposeResult, error: NSError?) {
// Dismiss the mail compose view controller.
controller.dismiss(animated: true, completion: nil)
}
【问题讨论】:
-
检查委托是否正确调用stackoverflow.com/questions/40305421/…
标签: ios swift3 mfmailcomposeviewcontroller