Dzwonię pod numer MFMailComposeViewController
z UITableViewController
. Problem jest metoda delegata nigdy nie jest wywoływana, gdy wybiorę Anuluj lub Wyślij przycisk Poczta komponować okno:Nie można zwolnić MFMailComposeViewController, delegat nie zadzwonił pod numer
mailComposeController:(MFMailComposeViewController*)controllerdidFinishWithResult
Oto klasa widoku tabeli:
@implementation DetailsTableViewController
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section==0 && indexPath.row==4) {
//SEND MAIL
MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
if ([MFMailComposeViewController canSendMail]) {
[controller setSubject:[NSString stringWithFormat:@"Ref %@",[item objectForKey:@"reference"]]];
[controller setMessageBody:@" " isHTML:NO];
[controller setToRecipients:[NSArray arrayWithObject:[item objectForKey:@"email"]]];
[self presentModalViewController:controller animated:YES];
}
[controller release];
}
}
- (void)mailComposeController:(MFMailComposeViewController*)controllerdidFinishWithResult:(MFMailComposeResult)result error:(NSError*)error {
// NEVER REACHES THIS PLACE
[self dismissModalViewControllerAnimated:YES];
NSLog (@"mail finished");
}
Aplikacja robi” t crash. Po naciśnięciu przycisku Anuluj lub Wyślij okno Kompozycji pozostaje na ekranie z wyłączonymi przyciskami. Mogę wyjść z aplikacji naciskając klawisz Home.
Jestem w stanie otworzyć inne widoki modalne z widoku TableView, ale nie MailCompose.
Uważam, że to tylko literówka w jego pytaniu. –