我有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