【发布时间】:2014-05-11 10:30:28
【问题描述】:
我一直在开发捕获图像和视频然后通过 MFMailComposer 将其发送到邮件的应用程序。我创建了内容和大小约为 6MB 的 zip 文件。我想在用户单击发送按钮并隐藏邮件控制器时显示加载视图,并且当邮件实际发送时我想通过警报显示消息。有什么办法吗?任何帮助将不胜感激。
【问题讨论】:
标签: ios ios7 mfmailcomposeviewcontroller mfmailcomposer
我一直在开发捕获图像和视频然后通过 MFMailComposer 将其发送到邮件的应用程序。我创建了内容和大小约为 6MB 的 zip 文件。我想在用户单击发送按钮并隐藏邮件控制器时显示加载视图,并且当邮件实际发送时我想通过警报显示消息。有什么办法吗?任何帮助将不胜感激。
【问题讨论】:
标签: ios ios7 mfmailcomposeviewcontroller mfmailcomposer
如果邮件已发送,您可以使用MFMailComposeViewControllerDelegate 方法获取信息:
- (void) mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
switch (result)
{
case MFMailComposeResultCancelled:
NSLog(@"Mail cancelled");
break;
case MFMailComposeResultSaved:
NSLog(@"Mail saved");
break;
case MFMailComposeResultSent:
NSLog(@"Mail sent");
break;
case MFMailComposeResultFailed:
NSLog(@"Mail sent failure: %@", [error localizedDescription]);
break;
default:
break;
}
// Close the Mail Interface
[self dismissViewControllerAnimated:YES completion:NULL];
}
不要忘记将MFMailComposeViewControllerDelegate 添加到您的.h 文件中
【讨论】: