我有UIAlertController
。點擊確定,顯示MFMailComposeViewController
。點擊電子郵件撰寫屏幕上的取消按鈕,我解僱了MFMailComposeViewController
。 MFMailComposeViewController
的委託方法在解散時被正確調用。 MFMailComposeViewController
成功解散。緊接着,如果我再次嘗試相同的功能(流程)。我沒有得到警覺,而是越來越低於錯誤。可能是什麼原因?我嘗試了大部分可用的解決方案。仍然遇到同樣的問題。先顯示UIAlertController,然後顯示MFMailComposeViewController。只有第一次作品
試圖提出< UIAlertController:上< MFMailComposeViewController 0x13890beb0>:0x1371ef000>誰的觀點是不是在窗口層次**
我使用self presentViewController
呈現alertcontroller和MFMailComposeViewController
。
示例代碼是在這裏:
- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(nullable NSError *)error{
[controller dismissViewControllerAnimated:YES completion: nil];
}
UIAlertController * alertController= [UIAlertController alertControllerWithTitle:@"Title" message:@"message" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* ok = [UIAlertAction
actionWithTitle:@"Ok"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
[alertController dismissViewControllerAnimated:YES completion:nil];
MFMailComposeViewController *mailComposerVC = [MFMailComposeViewController new];
mailComposerVC.mailComposeDelegate = self;
if ([MFMailComposeViewController canSendMail]) {
[self presentViewController:(MFMailComposeViewController*)mailComposerVC animated: true completion: nil];
}
}];
UIAlertAction* cancel = [UIAlertAction
actionWithTitle:@"Cancel"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
[alertController dismissViewControllerAnimated:YES completion:nil];
}];
[alertController addAction:ok];
[alertController addAction:cancel];
[self presentViewController:alertController animated:false completion:nil];
更新與相關的代碼你的問題。 – rmaddy
你可以請張貼一些代碼嗎?並決定您是使用Swift還是Objective-C – FelixSFD
http://stackoverflow.com/a/25864182/988769 – Kreiri