本文介绍了iOS6:MFMailComposeViewController加载缓慢,闪烁黑屏; MailCompositionS开始占用内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在iOS 6上,在发送几封电子邮件后(通过使用MFMailComposeViewController),电子邮件屏幕打开速度非常慢 - 首次打开时没有填充任何字段(没有主题,没有正文等)秒,并最终(在发送大约8条消息之后),在电子邮件视图控制器正确显示之前,向用户显示黑屏几秒钟。

On iOS 6, after sending a few email messages (by using MFMailComposeViewController), the email screens become very slow to open- at first opening with none of the fields populated (no Subject, no body, etc.) for a few seconds, and eventually (after sending about 8 messages), a black screen is displayed to the user for a few seconds before the email view controller is properly displayed.

在显示每个黑屏之前,日志会吐出以下行:

The log spits out the following line before each black screen is displayed:

此外,在iOS6上使用MFMailComposeViewController会导致MailCompositionS进程开始占用内存(它在我的iPhone上一直上升到大约260MB)。我假设这是MFMailComposeViewController显示问题的原因。

Also, using MFMailComposeViewController on iOS6 causes the MailCompositionS process to start hogging memory (it's going all the way up to roughly 260MB on my iPhone). I'm assuming this is the reason for the MFMailComposeViewController display issues.

在iOS 5上运行正常。此问题仅发生在iOS 6上。

Everything runs fine on iOS 5. This issue only occurs on iOS 6.

有没有人找到方法解决这个问题?

Has anyone found a way to resolve this issue?

谢谢!

代码是标准的,但无论如何我都会包含它:

The code is standard, but I'll include it anyway:

-(IBAction)doEmailLog:(id)sender 
{    
    if( [self canSendMail] )
    {       
        // create the compose message view controller
        MFMailComposeViewController* mailComposer = [[MFMailComposeViewController alloc] init];

        // this class will handle the cancel / send results
        mailComposer.mailComposeDelegate = self;

        // fill in the header and body
        [mailComposer setSubject:@"My Subject"];
        [mailComposer setMessageBody:@"My message body" isHTML:NO];

        // attach log file
        if ([[NSFileManager defaultManager] fileExistsAtPath:filename])
        { 
            NSData *data = [NSData dataWithContentsOfFile:filename];
            [mailComposer addAttachmentData:data mimeType:@"text/plain" fileName:filename];
        }

        // show the view controller
        [self presentViewController:mailComposer animated:YES completion:^{LogTrace(@"Presented mail view controller");}];
    }
    else
    {
        ...
    }
}

-(void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
    ...

    // dismiss the compose message view controller
    [self dismissViewControllerAnimated:YES completion:^{LogTrace(@"Finished dismissing mail controller");}];
}


推荐答案

在邮件编辑器ios 6上是你自己的应用程序(在你的内部)
::

on ios 6 the mail composer is its own app (inside yours):: http://oleb.net/blog/2012/10/remote-view-controllers-in-ios-6/

代码对我来说很好如果你使用ARC 否则它会泄漏,而ios6可能会导致x XPC遥控器

the code looks good to me if you are using ARC else it leaks and on ios6 that might result in x XPC remotes

如果一切都很好,我会把它归咎于苹果对XPC的新处理中的一个错误

if all is good there, Id blame it on a bug in apple's new handling of XPC

这篇关于iOS6:MFMailComposeViewController加载缓慢,闪烁黑屏; MailCompositionS开始占用内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 20:10