本文介绍了MFMailComposeViewController马上解散的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

情况是MFMailComposeViewController将被呈现。我看到它已经完成了一半,但后来被解雇了。

The situation is the MFMailComposeViewController was going to be presented. I saw it was presented half-way done, but then it got dismissed.

这是错误:

这是我提供MFMailComposeViewController的源代码:

This is my source code to present the MFMailComposeViewController:

-(void) MailExecute {
    if ([MFMailComposeViewController canSendMail]) 
    {
        MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];   
        mailViewController.mailComposeDelegate = self;
        [mailViewController setSubject:NSLocalizedString(@"Check this new look", @"")];
        [mailViewController setMessageBody: @"my new look" isHTML:YES];

        [self presentModalViewController:mailViewController animated:YES];

        [mailViewController release];
    }
    else 
    {
        UIAlertView *alertInternal = [[UIAlertView alloc]
                                      initWithTitle: NSLocalizedString(@"Notification", @"")
                                      message: NSLocalizedString(@"You have not configured your e-mail client.", @"")
                                      delegate: nil
                                      cancelButtonTitle:NSLocalizedString(@"OK", @"")
                                      otherButtonTitles:nil];
        [alertInternal show];
        [alertInternal release];
    }
}

奇怪的是,有时它会发生,有时它会发生没有。
请帮帮我吧!我花了差不多1个工作日来解决这个问题,但没有成功。

The weird point is that sometimes it happens, sometimes it doesn't.Please help me on this! I spend almost 1 working day to resolve this but no succeed.

推荐答案

你的代码看起来是正确的,并且正如强烈的错误消息所述建议这与 UIView 正确(具体不是 MFMail )有关。问题几乎肯定存在于代码中的其他地方,并且可能难以排除故障。

Your code looks correct, and as stated the error message strongly suggests this has something to do with UIView proper (not MFMail specifically). The problem almost surely lies somewhere elsewhere within your code, and might be challenging to troubleshoot.

需要注意的事项:


  1. 同时或不正确地发生其他动画或视图控制器转换/解雇()

  2. 发布/保留问题,当然

如果这些都不是修复程序,请尝试注释掉调用此方法的视图控制器中发生的所有其他事情,然后查看它是否有效。

If none of that seems like the fix, try commenting-out everything else happening in the view controller that calls this method and see if it works then.

如果仍然无法使其正常工作,请提供最简单的版本代码,以便我们可以进一步排除故障。 :)

If you still can't get it working, present the simplest version you can of failing code so we can troubleshoot further. :)

这篇关于MFMailComposeViewController马上解散的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 15:18