I'm working on MFMailComposeVC, want to have the function that if user cancel, show alertView and try to let him/her send the email again.
So in MFMailComposeViewControllerDelegate if result status is not Sent, I won't dissmissVC.
Then the funny thing is: User cancel, show alertView, MFVC won't dismiss, then send again, the delegate method won't be triggered. In fact no matter what user do(send, cancel, save draft), the delegate method will only be trigger once.
code sample:
- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
if (result == MFMailComposeResultSent){
[controller dismissViewControllerAnimated:YES completion:NULL];
} else {
NSLog(@"do something like show alert");
}
}
The delegate method will only be trigger once
EDIT: The present mailVC code:
MFMailComposeViewController* controller = [[MFMailComposeViewController alloc] init];
[controller setToRecipients:@"to email"];
[controller setSubject:@"the subject"];
[controller setMessageBody:@"the message body" isHTML:NO];
controller.mailComposeDelegate = self;
controller.modalPresentationStyle = UIModalPresentationFormSheet;
if (controller) {
[self presentViewController:controller animated:YES completion:nil];
}