In 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.
- MFMailComposeViewController *picker =[[MFMailComposeViewController alloc] init];
- picker.mailComposeDelegate = self;
- [picker setSubject:@"Check out Infuze (iPad/iPhone App)"];
- NSString*emailBody =@"Hi,
- Check out this cool iPad/iPhone application called as Infuze that I am using in Itunes or AppStore..
- Cheers";
- [picker setMessageBody: emailBody isHTML:YES];
- [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
Solution
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:
- if(picker !=nil){
- [self presentModalViewController: picker animated:YES];
- [picker release];
- }