I have implemented (successfully) the
mailComposeController:didFinishWithResult:error:
method to dismiss the mail compose view in other parts of my app, where the user taps on a particular icon I provide to send email. I understand I had to set the delegate and handle "didFinishWithResult" action of the user. Now in another part, I open a document and using
UIBarButtonSystemItemAction, Document controller, and presentOptionsMenuFromBarButtonItem: method
,
I allow user to email the document as PDF. Now the PDF gets successfully attached to the mail and can be sent after typing the email address. My problem is after the mail is sent, the compose view is not dismissed. Nor is it dismissed after cancel draft/save draft option. I guess I probably need an implementation of
- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
but I can't seem to hit this method. (And shouldn't this be taken care of automatically when using presentOptionsMenuFromBarButtonItem: ?). I could be setting the delegate incorrectly. Can anyone throw some light on if there is some built in way this should be taken care of, OR, how should the delegate be set for this.
I tried quite a few things, including Sebah's suggestion. Non of these worked. This was working fine for iOS 7.x but starting iOS 8 it gave me this problem. Finally it got solved on it's own when I moved from xCode 5 to 6. I guess some compatibility issues. xCode 5 was serving fine till iOS 7.x, but for iOS 8 and above, guess I had to mandatorily use xCode 6. This was an year ago, when using and packing your app with xCode 6 was not mandatory, hence we kept using xCode 5.