我的电子邮件表单遇到了一些麻烦。我只是在所有四个“ case MFmailcomposedresults”的switch语句中不断获得“使用无法解析的标识符'MF mailcomposedresultcancelled'等。...这是我的代码
@IBAction func SendMail(_ sender: Any) {
let toRecipients = ["whitandr@oregonstate.edu"]
let mc = MFMailComposeViewController()
mc.mailComposeDelegate = self
mc.setToRecipients(toRecipients)
mc.setSubject(Namtextfield.text!)
mc.setMessageBody("Name: \(Namtextfield.text!) \n\nEmail: \(emailtextfield.text!) \n\nMessage: \(messagetextfield.text!)", isHTML: false)
present(mc, animated: true, completion: nil)
}
func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?) {
switch result.rawValue {
case MFMailComposeResultCancelled.rawValue:
print("Mail cancelled")
case MFMailComposeResultSaved.rawValue:
print("Mail saved")
case MFMailComposeResultSent.rawValue:
print("Mail sent")
case MFMailComposeResultFailed.rawValue:
print("Mail sent failure: %@", [error?.localizedDescription])
default:
break
}
dismiss(animated: true, completion: nil)
}