It is noted that my MFMailComposeViewController, which I use to create an email dialog for sending email, no longer works in iOS6. It still displays a dialog, but I cannot set the body text or enter anything into the view. All I can do is click Cancel.
The class implements the MFMailComposeViewControllerDelegate interface, and here is some code:
//h file @interface ASEmailSender : NSObject //m file @implementation MyEmailSender () <MFMailComposeViewControllerDelegate> @end @implementation MyEmailSender ... - (void)emailFile:(ASFile *)file inController:(UIViewController *)viewController { MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init]; if ([MFMailComposeViewController canSendMail]) { mailController.mailComposeDelegate = self; [mailController setSubject:@"my subject"]; [mailController setMessageBody:@"msg body here" isHTML:NO]; [viewController showIsLoading:YES]; self.viewController = viewController [viewController presentModalViewController:mailController animated:YES]; } } - (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error { [self.viewController dismissModalViewControllerAnimated:YES]; }
It works great in iOS5.
source share