I created an application using both UINavigationController and UITabBarController. I'm trying to send mail using "MFMailComposeViewController" but get ab error and the application is crushed. My code:
(IBAction)SendMail:(UIButton *)sender { if([MFMailComposeViewController canSendMail]) { MFMailComposeViewController *mailCont = [[MFMailComposeViewController alloc] init]; mailCont.mailComposeDelegate = self;
[mailCont setSubject:@"yo!"]; [mailCont setToRecipients:[NSArray arrayWithObject:@"[email protected]"]]; [mailCont setMessageBody:@"Don't ever want to give you up" isHTML:NO]; [self presentModalViewController:mailCont animated:YES];
}
(void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error { [self dismissModalViewControllerAnimated:YES];
and i did import: #import