在iOS 6,发送一些电子邮件(通过使用MFMailComposeViewController)后,电子邮件屏幕成为与无填充字段(无主题,无体等)几秒钟第一开口给开很慢,最终(后发送约8消息),黑屏幕被显示给用户,以便在几秒钟被适当地显示在电子邮件视图控制器之前。
日志吐出下面一行显示每个黑屏之前:
[MFMailComposeRemoteViewController:....]超时等待来自com.apple.MailCompositionService围栏阻挡
此外,在iOS6的使用MFMailComposeViewController导致MailCompositionS进程来启动占用内存(它会一路攀升至大约260MB在我的iPhone)。 我假设这是对MFMailComposeViewController显示问题的原因。
一切都运行在iOS 5,此问题只发生在iOS 6的罚款。
有没有人找到了一种方法来解决这个问题?
谢谢!
该代码是标准的,但我会包括它无论如何:
-(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");}];
}