Getting a SIGABRT error in dismissModalViewController

Posted by mcalleja on Stack Overflow See other posts from Stack Overflow or by mcalleja
Published on 2012-03-25T04:11:06Z Indexed on 2012/03/26 5:29 UTC
Read the original article Hit count: 159

Im receiving a SIGABRT error when I cancel a MFMailComposeViewController, exactly in the dismissViewController, don't work

I have a UIViewController within a UINavigationController.

My Code:

- (void)sendMail {
    if ([MFMailComposeViewController canSendMail]) {
        controller = [[MFMailComposeViewController alloc] init];
        [[controller navigationBar] setTintColor:[UIColor getHexColorWithRGB:@"e2de09" alpha:1.0f]];
        controller.mailComposeDelegate = self;
        [controller setSubject:@"Subject"];            

        NSString *msg="xxxxx";
        [controller setMessageBody:msg isHTML:YES];

        [self presentModalViewController:controller animated:YES];

    } else {
        NSString * errorString = [NSString stringWithFormat:@"mail account not set."];

        UIAlertView * errorAlert = [[UIAlertView alloc] initWithTitle:@"Error:" message:errorString delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [errorAlert show];
    }
}

The presentModalViewController:animated: works correctly.

- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error {
    [self becomeFirstResponder];
    [self dismissModalViewControllerAnimated:YES];
}

But calling [self dissmissModalViewControllerAnimatedLYES] causes a SIGABRT error.

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about ios