【发布时间】:2018-12-16 22:54:08
【问题描述】:
When sending an email:
if MFMailComposeViewController.canSendMail()
{
let mail = MFMailComposeViewController()
mail.mailComposeDelegate = self
// the set to receipient
// is always this email
// since this is the owners email
mail.setSubject("ORDER CONFIRMATION RODEO'S CATERING")
mail.setToRecipients(["rodeoscatering2018@gmail.com"])
mail.setMessageBody( m_information_for_body , isHTML: false)
self.present(mail, animated: true)
}
func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?)
{
// In here I am checking if it is sent
case .sent:
do
{
print("sent")
controller.dismiss(animated: true, completion: nil)
// and then doing a performSegue below...
// performSegue(withIdentifier....)
}
}
我知道这不是标识符的问题,所有的转义都在那里。我看到了打印信息。但不幸的是,所有发生的事情是,当出现电子邮件提示时,我按下发送,然后电子邮件控制器被关闭(这很好)并将我带到我所在的当前屏幕并显示打印消息,但是 performSegue 没有不会发生。
我基本上希望它在发生 .sent 案例的情况下返回主页
Swift 4.2 和最新的 xCode 10.1
【问题讨论】:
-
在
completion handler中尝试performSegue在dismiss中 -
@Willjay,谢谢。这很好用。我在下面为其他人发布了一个代码示例。
标签: ios swift uiviewcontroller segue