Search code examples
cocoa-touchmfmailcomposeviewcontroller

Xcode: Check whether email was send or canceled


I want to make a login with an email registration and for that I have to check whether the user clicked on "send" or "cancel". Is there any possibility to check this? Cause if the user doesn't send it I don't want that he comes in my app. regards


Solution

  • If you use default MFMailComposeViewController try to check '(MFMailComposeResult)result' in:

    // Then implement the delegate method
    - (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error {
        [self dismissModalViewControllerAnimated:YES];
    }
    
    
    
    
    enum MFMailComposeResult {
    
       MFMailComposeResultCancelled,
    
       MFMailComposeResultSaved,
    
       MFMailComposeResultSent,
    
       MFMailComposeResultFailed
    
    };
    typedef enum MFMailComposeResult MFMailComposeResult;