4

Once I present my MFMailComposeViewController it is dismissed with error:

viewServiceDidTerminateWithError: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}

What is going on?

VERY IMPORTANT NOTE

It is working very well under iOS8.

Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358

1 Answers1

0

i can't help you since you did not post any code, but here is a working copy of a MailComposeController on iOS9, using it in my app without any problem. Important set your class conform to MFMailComposeViewControllerDelegate. Note that sendMail method is related to a button in my project

@IBAction func sendMail(sender: AnyObject) {

    let mailComposeViewController = configuredMailComposeViewController()

    if MFMailComposeViewController.canSendMail() {
        self.presentViewController(mailComposeViewController, animated: true, completion: nil)
    } else {
        self.showSendMailErrorAlert()
    }
}


func configuredMailComposeViewController() -> MFMailComposeViewController {
    let mailComposerVC = MFMailComposeViewController()
    mailComposerVC.mailComposeDelegate = self 
    mailComposerVC.setToRecipients(["yourMail@goesHere"])

    return mailComposerVC
}

func showSendMailErrorAlert() {

   print("There was an error.")
    //In case of error with email account on device, you should implement an alert here

}

func mailComposeController(controller: MFMailComposeViewController, didFinishWithResult result: MFMailComposeResult, error: NSError?) {
    controller.dismissViewControllerAnimated(true, completion: nil)
}
Simone
  • 91
  • 1
  • 8