Iphone app getting crashing when i enter the iphone mail sheet

Posted by Gopinath on Stack Overflow See other posts from Stack Overflow or by Gopinath
Published on 2012-12-11T04:56:31Z Indexed on 2012/12/11 5:04 UTC
Read the original article Hit count: 138

Filed under:
|
|
|
|

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];
    }
 }

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c