How to prevent crash on Cancel of MFMailComposeViewController?

前端 未结 2 1273
感动是毒
感动是毒 2021-01-01 02:14

Somewhere:

if([MFMailComposeViewController canSendMail])
{
    MFMailComposeViewController *email_vc = [[MFMailComposeViewController alloc] init];
    email_         


        
2条回答
  •  情深已故
    2021-01-01 02:27

    this works for me:

    - (void) mailComposeController: (MFMailComposeViewController *) controller
           didFinishWithResult: (MFMailComposeResult) result
                         error: (NSError *) error {
    
    if(result == MFMailComposeResultSent){
        [self dismissViewControllerAnimated:YES completion:NULL];
    } else if (result == MFMailComposeResultCancelled) {
        [self dismissViewControllerAnimated:YES completion:NULL];
    }
    

    }

提交回复
热议问题