Tôi đang gọi MFMailComposeViewController
từ số UITableViewController
. Vấn đề là phương pháp đại biểu không bao giờ được gọi là khi tôi chọn Hủy hoặc Gửi nút trong Mail soạn cửa sổ:Không thể loại bỏ MFMailComposeViewController, đại biểu không được gọi là
mailComposeController:(MFMailComposeViewController*)controllerdidFinishWithResult
Đây là lớp xem bảng:
@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");
}
Ứng dụng này doesn' t sụp đổ. Sau khi nhấn nút Hủy hoặc Gửi, Cửa sổ Soạn thư sẽ ở lại trên màn hình với các nút bị tắt. Tôi có thể thoát khỏi ứng dụng bằng cách bấm phím Home.
Tôi có thể mở biểu mẫu Chế độ xem phương thức khác TableView chứ không phải MailCompose.
Tôi tin rằng đây chỉ là lỗi đánh máy trong câu hỏi của anh ấy. –