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:
[MFMailComposeRemoteViewController: ....] timed out waiting for fence barrier from com.apple.MailCompositionService
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.
Everything runs fine on iOS 5. This issue only occurs on iOS 6.
Has anyone found a way to resolve this issue?
Thanks!
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");}];
}