Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MFMailComposeViewController : cancel doesn't exit to my app?

I'm trying to send a mail with MFMailComposeViewController. It happens when I click a button on my app. Of course when I click the Cancel button of the mail controller I want to go back to my app view but it doesn't work. What to do ? Here is my code :

MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
[controller setSubject:@"Subject"];
[controller setMessageBody:@"<html>Test</html>" isHTML:YES];
[controller setToRecipients:nil];
if(controller) [self presentModalViewController:controller animated:YES];

Thanks for your advices

like image 780
Rob Avatar asked Jun 12 '12 08:06

Rob


1 Answers

Have you implemented this delegate method? It's called after the composer is exited by the user.

- (void)mailComposeController:(MFMailComposeViewController*)controller 
      didFinishWithResult:(MFMailComposeResult)result
                    error:(NSError*)error 
{ 
    [self dismissViewControllerAnimated:YES completion:nil];
    return;
}
like image 187
Damo Avatar answered Oct 20 '22 13:10

Damo