I am setting up MFMailComposer within app. I want it to have a UIAlertView display the results of sending the email. I have this code installed:
However, when I debug, no matter what I press, every UIAlertView will pop up. What is the cause of this?
Code:
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
message.hidden = NO;
// Notifies users about errors associated with the interface
switch (result)
{
case MFMailComposeResultCancelled:{
UIAlertView *cancelled = [[UIAlertView alloc] initWithTitle:@"Results" message:@"Email Was Cancelled" delegate:self cancelButtonTitle:@"Okay" otherButtonTitles:nil];
[cancelled show];
[cancelled release];}
case MFMailComposeResultSaved:{
UIAlertView *saved = [[UIAlertView alloc] initWithTitle:@"Results" message:@"Email Draft Saved" delegate:self cancelButtonTitle:@"Okay" otherButtonTitles:nil];
[saved show];
[saved release];}
case MFMailComposeResultSent:{
UIAlertView *sent = [[UIAlertView alloc] initWithTitle:@"Results" message:@"Email Sent" delegate:self cancelButtonTitle:@"Okay" otherButtonTitles:nil];
[sent show];
[sent release];
}
case MFMailComposeResultFailed:{
UIAlertView *failed = [[UIAlertView alloc] initWithTitle:@"Results" message:@"Email Failed To Send, Please Check Internet Connection And Try Again." delegate:self cancelButtonTitle:@"Okay" otherButtonTitles:nil];
[failed show];
[failed release];
}
}
[self dismissModalViewControllerAnimated:YES];
}