Possible Duplicate:
Action sheet doesn't display when the MFMailComposeViewController's cancel button is tapped
I've implemented standard mail functionality in my app according to the code sample provided by Apple.
I'm setting up the delegate as follows:
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
and I'm implementing
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
Hitting the Send button invokes the delegate and it all works fine. However, hitting the Cancel button doesn't call the delegate and it just dims the view; the app hangs right there.
After reading similar threads here, I've been thinking that the view could be off-screen for some reason which is beyond my comprehension at this point. Note that the view is being created programmatically and is not using a xib file.
Any thoughts or ideas ?
You need to implement mailComposeController:didFinishWithResult:error
delegate. And in that you dismiss the view which is showing your mail view. If you have opened the mail view as a modalView, then the way to dismiss this is -
- (void)mailComposeController:(MFMailComposeViewController*)controller
didFinishWithResult:(MFMailComposeResult)result
error:(NSError*)error
{
if(error) NSLog(@"ERROR - mailComposeController: %@", [error localizedDescription]);
[self dismissModalViewControllerAnimated:YES];
return;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With