I'm having difficulty closing the email message that I picked up.
E-mail opens beautifully, but after it is opened it will not be closed, because mailComposeController: mailer didFinishWithResult: result error: the error handler is never called.
As far as I can tell, I have all the bits to be able to do this.
Any ideas on what I can look at?
Here's how I put up an email:
-(IBAction)emailButtonPressed {
NSString * text = @ "My email text";
MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init]; mailer.delegate = self; [mailer setSubject:@"Note"]; [mailer setMessageBody:text isHTML:NO]; [self presentModalViewController:mailer animated:YES]; [mailer release]; }
and then in the class I have this code to handle closing (but it never gets called):
-(void)mailComposeController:(MFMailComposeViewController *)mailer didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error { [self becomeFirstResponder]; [mailer dismissModalViewControllerAnimated:YES]; }
My header file is defined as:
#import <UIKit/UIKit.h> #import <MessageUI/MessageUI.h> #import <MessageUI/MFMailComposeViewController.h> @interface myViewController : UIViewController <UIActionSheetDelegate, UIAlertViewDelegate, MFMailComposeViewControllerDelegate, UINavigationControllerDelegate>
thanks
Ifaaw
source share