【发布时间】:2012-01-17 21:03:10
【问题描述】:
我一直在寻找解决问题的方法,但到目前为止还没有找到任何东西。
我有一个 UINavigationController 和一堆 UIViewControllers(如果相关,这都在 TabbarController 中)。在最后一个ViewController,我想发邮件:
MFMailComposeViewController *emailVC = [[MFMailComposeViewController alloc] init];
// fill out emailVC properties ...
[self presentModalViewController:emailVC animated:YES];
然后在发送电子邮件后的委托中,我想关闭电子邮件视图控制器并弹出 NavigationController 堆栈中的最后一个视图控制器:
-(void)mailComposeController:(MFMailComposeViewController *)controller
didFinishWithResult:(MFMailComposeResult)result
error:(NSError *)error
{
// save some variables here ...
[self dismissModalViewControllerAnimated:YES]; // This line works by itself
[self.navigationController popViewControllerAnimated:NO]; // this line causes EXC_BAD_ACCESS
但是,最后一行会导致某处崩溃。 我之前和之后检查了 ViewController 堆栈。最后一个 viewController 正确地从列表中删除。
欢迎任何想法或建议。问题可能出在我的代码中的其他地方,我想确保这部分没问题。谢谢。
【问题讨论】:
标签: iphone ios uinavigationcontroller uikit