MFMailComposeViewControllerIn you application you are calling the MFMailComposeViewController to launch the email composer window, but you are getting an error running the application on the iPad device, however it works perfectly fine on the iPad simulator.

  1.     MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
  2.     picker.mailComposeDelegate = self;
  3.     [picker setSubject: @"Check out Infuze (iPad/iPhone App)"];
  4.     NSString *emailBody = @"Hi,
  5. Check out this cool iPad/iPhone application called as Infuze that I am using in Itunes or AppStore..
  6. Cheers";
  7.     [picker setMessageBody: emailBody isHTML: YES];
  8.     [self presentModalViewController: picker animated: YES];

The appplcation crashes and the following error is generated:

Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘Application tried to present a nil modal view controller on target


Basically the Mail Composer is not able to launch the view screen if Email is not configured the iPad. So check if that is the case. Also to avoid this crash add a NPE check before invoking the Mail Composer view as:

  1. if (picker != nil) {
  2.         [self presentModalViewController: picker animated: YES];
  3.                 [picker release];
  4.         }