In my Xcode project, I'm trying to show an alert after the mail UI is closed only if the mail was cancelled but I'm getting an error (Switch Case is in protected scope) and it is showing on all the lines that start with "case".
typedef enum MFMailComposeResult MFMailComposeResult;
switch (result)
{
case MFMailComposeResultCancelled:
[self dismissViewControllerAnimated:YES completion:NULL];
UIAlertView *theAlert = [[UIAlertView alloc] initWithTitle:@"Report Sent"
message:@"Your report has been sent and it will be reviewed. If you are in an emergency, remember to call 911."
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[theAlert show];
NSLog(@"Mail cancelled");
break;
case MFMailComposeResultSaved:
NSLog(@"Mail saved");
break;
case MFMailComposeResultSent:
NSLog(@"Mail sent");
break;
case MFMailComposeResultFailed:
NSLog(@"Mail sent failure: %@", [error localizedDescription]);
break;
default:
break;
}