ios - Mail Compose not dismiss when click cancel button -
I have this code that sends the e-mail to the user, using MFMmail:
.h file
#import & lt; UIKit / UIKit.h & gt; #import & lt; Message UI / Message UI H & GT; #important & lt; Message ii / mfmail combo viewcontroller.h & gt; @ Interface Test Visual Controller: UIViewController & lt; MFMailComposeViewControllerDelegate, MFMessageComposeViewControllerDelegate & gt; @protecti (nanatomic, assign) id & lt; MFMailComposeViewControllerDelegate & gt; MailComposeDelegate;
.m file
@Synthesis Mail Write permission - Send (Zero) Email: (NSString *) Heroity // // Veer received email NSString * corpoMensagem = @ "There is no body yet ..."; // If within your Active View Controller ([MFMailComposeViewController canSendMail]) {MFMailComposeViewController * mailCont = [[MFMailComposeViewController alloc] init]; MailCont.mailComposeDelegate = self; // MailCont set subject to start mailComposeController when sending: @ "FazerBem - Recibo de Compra"]; [Melkant Settrient Panties: [NSARA array: Charity]]; [MailContentMessageBody: CorpoMensagem's HTML: Yes]; [Self-present ViewController: animated mailCont: yes complete: zero]; }} - (empty) Mail Compass Controller: (MFmail Comptic Wink Controller *) Controller did the Finish Results: (MFmail Compass Result) Result Error: (NSER * *) Error {If (Error) Send {NSString * errorTitle = @ " Error for "; NSString * ErrorDiscription = [Error localization]; UIAlertView * Errorview = [[UIAlertView alloc] initWithTitle: errorTitle Message: ErrorCore Representative: AutoCutTutton Title: Zero Other Button: @ "OK", Zero]; [Show error view]; } [Self-made First Responder]; [Self shotgun viewer unpowered: yes complete: zero]; } - (Zero) Message View Controller: (MFMessageComposeViewController *) Administrator didFinishWithResult: (MessageComposeResult) Result {}
When I click the send button, it can send email to the recipient And close the screen, when I click on the cancel button, I click on any app crash and give me the following error: this 2 more options 'Delete Draft' and 'Save Draft' Opens:
[TestViewController's Answer: To-Selector:]: The canceled version was sent to 0x16b3b470
How can I solve this problem?
Use the switch case to take action:
- (Zero) Mail Compage Controller: (MFMailComposeViewController *) Controller was FinishWithResult: (MFMailComposeResult) Result Error: (NSError *) Error {UIAlertView * Warning; Switch (result) {case MFMailComposeResultCancelled: break; Case MFMailComposeResultSaved: Warning = [[UIAlertView alloc] initWithTitle: @ "Draft saved" message: @ "Created mail saved in draft". Representative: Cancel zeroTuttonal: @ "OK" other button button: zero, zero]; [Alerts show]; break; Case MFMailComposeResultSent: Warning = [[UIAlertView alloc] initWithTitle: @ "Success" Message: @ "You've successfully mentioned your friends." Representative: Cancel zeroTuttonal: @ "OK" other button button: zero, zero]; [Alerts show]; break; Case MFMailComposeResultFailed: Warning = [[UIAlertView alloc] initWithTitle: @ "Failed" message: @ "Sorry, sending failed." Representative: Cancel zeroTuttonal: @ "OK" other button button: zero, zero]; [Alerts show]; break; Default: Break; } // Close the mail interface [self shotgun viewer: unlimited: yes complete: zero]; }
Comments
Post a Comment