Iphone app getting crashing when i enter the iphone mail sheet
- by Gopinath
In my iphone app. I'm Creating Iphone Mail Chat Sheet using MFMailComposeViewController. Now when I enter the second time,the mail sheet, my app is getting crashed. I searched in Google. But I couldn't find the solution. Anybody help me to solve my issue. PLease see this below code and help me where am I doing wrong.
if ([MFMailComposeViewController canSendMail])
{
controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
[controller setSubject:@""];
[controller setToRecipients:array1];
[controller setMessageBody:@"" isHTML:NO];
[controller setMailComposeDelegate: self];
[controller setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
[self.navigationController presentModalViewController:controller animated:NO];
[controller release];
}
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
if(result == MFMailComposeResultSent)
{
[[self parentViewController] dismissModalViewControllerAnimated:YES];
}
else if (result == MFMailComposeResultCancelled)
{
[[self parentViewController] dismissModalViewControllerAnimated:YES];
}
}