小编jan*_*way的帖子

dismissModalViewController然后popViewController

我一直在寻找解决我的问题的方法但到目前为止还没找到任何东西.

我有一个带有UIViewControllers堆栈的UINavigationController(如果相关的话,这都在TabbarController中).在最后一个ViewController,我想发送一封电子邮件:

MFMailComposeViewController *emailVC = [[MFMailComposeViewController alloc] init];
// fill out emailVC properties ...
[self presentModalViewController:emailVC animated:YES];
Run Code Online (Sandbox Code Playgroud)

然后在发送电子邮件后的委托中,我想关闭电子邮件viewcontroller并弹出NavigationController堆栈中的最后一个viewcontroller:

-(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
Run Code Online (Sandbox Code Playgroud)

但是,最后一行导致某处崩溃.我之前和之后检查过ViewController堆栈.最后一个viewController正确地从列表中删除.

欢迎任何想法或建议.问题可能在我的代码中的其他地方,我想确保我有这个部分.谢谢.

iphone uikit uinavigationcontroller ios

2
推荐指数
1
解决办法
3198
查看次数

标签 统计

ios ×1

iphone ×1

uikit ×1

uinavigationcontroller ×1