2
按下取消或發送按鈕後不能解除MFMailComposeViewController
。我在班上添加了MFMailComposeViewControllerDelegate
,但仍然無法使用?不能關閉Swift 3.0中的MFMailComposeViewController
這裏是我的代碼:
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)
}
檢查一次代表呼籲正確與否https://stackoverflow.com/questions/40305421/how-to-close-mfmailcomposeviewcontroller –