objective-c - MFMailComposeViewController : cancel doesn't exit to my app?

标签 objective-c ios email mfmailcomposeviewcontroller

我正在尝试使用 MFMailComposeViewController 发送邮件。当我点击我的应用程序上的按钮时会发生这种情况。当然,当我单击邮件 Controller 的取消按钮时,我想返回到我的应用程序 View ,但它不起作用。该怎么办 ?这是我的代码:

MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
[controller setSubject:@"Subject"];
[controller setMessageBody:@"<html>Test</html>" isHTML:YES];
[controller setToRecipients:nil];
if(controller) [self presentModalViewController:controller animated:YES];

谢谢你的建议

最佳答案

你有没有实现这个委托(delegate)方法?它在用户退出 Composer 后调用。

- (void)mailComposeController:(MFMailComposeViewController*)controller 
      didFinishWithResult:(MFMailComposeResult)result
                    error:(NSError*)error 
{ 
    [self dismissViewControllerAnimated:YES completion:nil];
    return;
}

关于objective-c - MFMailComposeViewController : cancel doesn't exit to my app?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10992725/

相关文章:

objective-c - UIScrollView 就像新的 iOS App Store

objective-c - 贝塞尔路径看是否交叉

ios - 不是可以使用 watch 屏幕的全宽吗?始终获得 1 点边框

ios - 快速警报自定义显示和分配

VBA Excel Outlook 电子邮件正文格式

iphone - 从导航 Controller 弹出 View 后递归不会停止

ios - 将数据传递给根 Controller

ios - swift 5 : Binary operator '==' cannot be applied to operands of type 'AnyObject?' and 'UIView?'

google-apps-script - 在 Google Apps 脚本中创建电子邮件 - 无法创建 ä、ö、ü 等特殊字符

c# - 通过 C# 网页发送大量电子邮件的最佳方式是什么?