MFMailComposer Mail发送回调

时间:2014-05-11 10:30:28

标签: ios ios7 mfmailcomposeviewcontroller mfmailcomposer

我一直致力于捕获图像和视频的应用程序,然后通过MFMailComposer将其发送到邮件。我创建了内容和大小约为6MB的zip文件。我想在用户点击发送按钮并隐藏邮件控制器时显示加载视图,当邮件实际发送时我想通过警报显示邮件。有什么办法吗?任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

如果邮件已发送,您可以使用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文件