Objective c iOS6:MFMailComposeViewController加载缓慢并闪烁黑屏;邮件开始占用内存
在iOS 6上,发送几封电子邮件后(通过使用MFMailComposeViewController),电子邮件屏幕的打开速度变得非常慢-最初打开时,没有填充任何字段(没有主题、没有正文等),持续几秒钟,最后(在发送大约8封邮件后),在正确显示电子邮件视图控制器之前,会向用户显示几秒钟的黑屏 在显示每个黑屏之前,日志会弹出以下行: [MFMailCompositeMoteViewController:…]等待围栏时超时 来自com.apple.MailCompositionService的障碍 此外,在iOS6上使用MFMailComposeViewController会导致MailCompositionS进程开始占用内存(在我的iPhone上,它会一直占用大约260MB的内存)。我假设这就是MFMailComposeViewController显示问题的原因 在iOS 5上一切运行正常。此问题仅在iOS 6上发生 有没有人找到解决这个问题的方法 谢谢 代码是标准的,但我还是要包括它:Objective c iOS6:MFMailComposeViewController加载缓慢并闪烁黑屏;邮件开始占用内存,objective-c,ios6,mfmailcomposeviewcontroller,mfmailcomposer,Objective C,Ios6,Mfmailcomposeviewcontroller,Mfmailcomposer,在iOS 6上,发送几封电子邮件后(通过使用MFMailComposeViewController),电子邮件屏幕的打开速度变得非常慢-最初打开时,没有填充任何字段(没有主题、没有正文等),持续几秒钟,最后(在发送大约8封邮件后),在正确显示电子邮件视图控制器之前,会向用户显示几秒钟的黑屏 在显示每个黑屏之前,日志会弹出以下行: [MFMailCompositeMoteViewController:…]等待围栏时超时 来自com.apple.MailCompositionService的障碍 此
-(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上,mail composer是它自己的应用程序(在您的应用程序中) ::
如果您使用的是ARC,代码在我看来很好,否则它会泄漏,并且在ios6上可能会导致x XPC远程
如果一切都好的话,我会把它归咎于苹果新的XPC处理中的一个错误,还有另一个可能的解决方案: 从外观方法中删除自定义字体(如果有)
感谢您的回复!是的,我使用的是ARC,所以这些代码片段中不应该出现泄漏。我看了Ole的博客,虽然内容丰富,但没有提供任何解决方案。仍然在寻找解决方案…这个问题的原因很奇怪。。。启动MFMailComposeViewController的视图控制器有一个导航栏。如果在启动视图控制器的ViewWillExample()和ViewWillEnglishe()函数中更改导航栏上按钮的背景图像,则每次启动和关闭MFMailComposeViewController时,MailCompositionServiceS将使用并保留7-10MB的内存。这对我来说毫无意义,但当我们停止在UIBarButtonItems上调用setBackgroundImage()时,MailCompositionServiceS中的内存问题就停止了。想想……你找到解决这个问题的办法了吗?是的。我也有同样的问题。我退出模拟器并重新启动它;问题解决了(!?)多么悲惨的问题。我们有很多测试设备,所以“幸运地”发现了问题。仅使用全局编写器的解决方案似乎是完全可靠的。希望它能帮助别人。现在是2013年11月。。解决方法似乎是使用全局MFMailComposeViewController。。不要用本地的。奇怪的同样的问题。。“exu”首先提出了解决方案,谢谢exu!