Note that there are some explanatory texts on larger screens.

plurals
  1. POMFMailComposeViewController navigation bar buttons are disabled
    text
    copied!<p>I use MFMailComposeViewController to send mail in my app. But when present mail compose view controller, all of navigation buttons are disabled (except back button in select mail address screen), i must use Home button to quit app. Does anyone has idea? Here is screen shot: <img src="https://img.skitch.com/20120114-kfgrye3ssrd3ssc7pe18g2cb4w.jpg" alt="Screen shot"> <img src="https://img.skitch.com/20120114-ms2n73wbm6958ttbrfp1pj5ab7.jpg" alt="2"></p> <p><br> Code: <br></p> <pre> - (void)shareVieEmail { if ([MFMailComposeViewController canSendMail]) { MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init]; mailViewController.mailComposeDelegate = self; [mailViewController setSubject:@"Test subject"]; [mailViewController setMessageBody:@"Mail message body" isHTML:NO]; NSData *imageData = [NSData dataWithContentsOfFile:photourl]; [mailViewController addAttachmentData:imageData mimeType:@"image/jpg" fileName:@"example_photo"]; [self presentModalViewController:mailViewController animated:YES]; } else { [[[UIAlertView alloc] initWithTitle:@"Cannot send mail" message:@"Device is unable to send email in its current state" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil] show]; } } </pre> <p>Delegate method : <br></p> <pre> - (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error { switch (result) { case MFMailComposeResultCancelled: //NSLog(@"Result: canceled"); break; case MFMailComposeResultSaved: //NSLog(@"Result: saved"); break; case MFMailComposeResultSent: { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Result" message:@"Mail Sent Successfully" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; [alert show]; } break; case MFMailComposeResultFailed: { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Result" message:@"Mail Sent Failed" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; [alert show]; } break; default: //NSLog(@"Result: not sent"); break; } if (error) { [[[UIAlertView alloc] initWithTitle:@"Cannot send mail" message:[NSString stringWithFormat:@"ERROR:%@", [error userInfo]] delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil] show]; } [self dismissModalViewControllerAnimated:YES]; } </pre> <p>And in header file, I declared implement MFMailComposeViewControllerDelegate.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload