Below is a Switch / Case statement that displays an error message when an email cannot be sent. For the most part, everything seems right, but when I place a UIAlertView
into the Switch Statement I get an error in Xcode:
switch (result) {
case MFMailComposeResultCancelled:
NSLog(@"Result: Mail sending canceled");
break;
case MFMailComposeResultFailed:
NSLog(@"Result: Mail sending failed");
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Sending Failed"
message:@"The email could not be sent."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[message show];
break;
default:
NSLog(@"Result: Mail not sent");
break;
}
Why does it generate an error when I place code inside the case
?