oadash
oadash

Reputation: 1

MFMailComposeViewController ModalView crashes the iOS5 application

I have an iOS TabBar Application with tabbarcontroller and navigationcontroller. In my detail view wich is pushed from my first tab tableviewcontroller i have sharing navigationItem.rightBarButtonItem with email sharing.

I have the following code for this:

    - (void)share
{   
    UIActionSheet *popupQuery = [[UIActionSheet alloc] initWithTitle:@"Send" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Email",nil];
    popupQuery.actionSheetStyle = UIActionSheetStyleBlackTranslucent;
    [popupQuery showInView:self.view];
    [popupQuery release];
}

-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {

      if (buttonIndex == 0) {
        if ([MFMailComposeViewController canSendMail]){
            MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
            [picker setMailComposeDelegate:self];
            [picker setSubject:@"New theme"];
            NSString *emailBody = @"Hi there";
            [picker setMessageBody:emailBody isHTML:NO];
            [self resignFirstResponder];
            picker.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
            picker.modalPresentationStyle = UIModalPresentationCurrentContext;
            [self presentModalViewController:picker animated:NO];
            [picker release];

        }
        else{
        }
}
}

The app shows me the composing view but when i'm trying to do something with this view (e.g. to pick up the address or to spell something) - app crashes with SIGTRAP.

The app crashes only in iOS5, iOS5.1. In iOS4.2.1 everything works perfect.

What's the problem? Any ideas?

Upvotes: 0

Views: 1475

Answers (2)

oadash
oadash

Reputation: 1

Thank you guys for your help and your time.
It was absolutely insane bug. Project has a cyrillic name. I just renamed it to latin name and now everything works fine. My fault :( Thanks Evgeniy Shurakov for the help.

Upvotes: 0

Rob
Rob

Reputation: 437392

Per the docs, I'd suggest calling [MFMailComposeViewController canSendMail] class method before creating MFMailComposeViewController. I also generally don't have that [self resignFirstResponder] line. I gather you're crashing before your mailComposeController:didFinishWithResult:error method is invoked?

Upvotes: 1

Related Questions