gpt4 book ai didi

swift - 在应用程序中关闭电子邮件弹出窗口后显示消息警报

转载 作者:行者123 更新时间:2023-11-30 11:30:47 24 4
gpt4 key购买 nike

我想在点击发送或取消电子邮件弹出窗口后立即显示一个警报 Controller ,显示我的邮件是否已发送,我已设法在发送消息之前而不是在发送消息之后显示警报 Controller ...:

func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?) {


switch result {
case .cancelled:

let alertController = UIAlertController.init(title: "Cancelled", message: "Send Email has been cancelled", preferredStyle: .alert)
alertController.addAction(UIAlertAction.init(title: "Ok", style: .default, handler: { (alertAction) in
controller.dismiss(animated: true, completion: nil)
}))
controller.present(alertController, animated: true, completion: nil)

case .sent:



let alertController = UIAlertController.init(title: "Sent", message: "Message Sent Successfully", preferredStyle: .alert)
alertController.addAction(UIAlertAction.init(title: "Ok", style: .default, handler: { (alertAction) in
controller.dismiss(animated: true, completion: nil)

}))



default:
break;
}

这是我尝试过的

最佳答案

问题是你尝试使用一个弹出窗口的 Controller ,而且它会被关闭,你可以尝试

 UIApplication.shared.keyWindow?.rootViewController?.present(alertController, animated: true, completion: nil)

关于swift - 在应用程序中关闭电子邮件弹出窗口后显示消息警报,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50282586/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com