MFMailComposeViewController in Swift does not dismiss

后端 未结 3 541
我寻月下人不归
我寻月下人不归 2020-12-17 20:57

This is sample code:

import UIKit
import MessageUI

class ViewController: UIViewController, MFMailComposeViewControllerDelegate {

@IBAction func showEmail(         


        
3条回答
  •  有刺的猬
    2020-12-17 21:32

    You're trying to dismiss self instead of the MFMailComposeViewController (which isn't self).

    Replace:

    self.dismissModalViewControllerAnimated(true)
    

    with:

    controller.dismissViewControllerAnimated(true, completion: nil)
    

    in the delegate method.

提交回复
热议问题