I have added a function of “Email” in my iPhone application and it is crashing on iPhone but working on simulator. Please guide me why it is crashing on Device
this is the code
-(IBAction)sendMail{
MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
[controller setSubject:@"Contact"];
[controller setToRecipients:[NSArray arrayWithObject:@"Contact@BettorsSidekick.com"]];
[controller setMessageBody:@"" isHTML:NO];
[self presentModalViewController:controller animated:YES];
[controller release];
}
- (void)mailComposeController:(MFMailComposeViewController*)controller
didFinishWithResult:(MFMailComposeResult)result
error:(NSError*)error;
{
if (result == MFMailComposeResultSent) {
NSLog(@"It's away!");
}
[self dismissModalViewControllerAnimated:YES];
}
use this code its work fine.