MFMailComposeViewController发送状态

时间:2013-02-12 20:58:55

标签: ios mfmailcomposeviewcontroller

有没有办法从MFMailComposeViewController获取状态? 假设我正在发送一封包含20张图片的电子邮件,我想显示一些加载,然后在发送完成后隐藏加载。

2 个答案:

答案 0 :(得分:1)

没有。一旦用户选择发送电子邮件并在您的应用程序中调用委托方法,则电子邮件将位于发件箱中,等待由某个后台邮件守护程序发送。没有API来获取此类电子邮件的状态。即使由于某种原因无法发送邮件,该应用也无法获取此信息。

答案 1 :(得分:-1)

try the delegate methods may be it help you.


#pragma mark - MailComposeController

- (void)mailComposeController:(MFMailComposeViewController*)controller  didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
    switch (result)
    {
        case MFMailComposeResultCancelled:
            NSLog(@"Mail cancelled: you cancelled the operation and no email message was queued.");
            break;
        case MFMailComposeResultSaved:
            NSLog(@"Mail saved: you saved the email message in the drafts folder.");
            break;
        case MFMailComposeResultSent:
            NSLog(@"Mail send: the email message is queued in the outbox. It is ready to send.");
            break;
        case MFMailComposeResultFailed:
            NSLog(@"Mail failed: the email message was not saved or queued, possibly due to an error.");
            break;
        default:
            NSLog(@"Mail not sent.");
            break;
    }

}