This is sample code:
import UIKit import MessageUI class ViewController: UIViewController, MFMailComposeViewControllerDelegate { @IBAction func showEmail(
You're trying to dismiss self instead of the MFMailComposeViewController (which isn't self).
self
MFMailComposeViewController
Replace:
self.dismissModalViewControllerAnimated(true)
with:
controller.dismissViewControllerAnimated(true, completion: nil)
in the delegate method.