应用程序试图在目标上推送一个 nil 视图控制器 [英] Application tried to push a nil view controller on target

查看:65
本文介绍了应用程序试图在目标上推送一个 nil 视图控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到以下错误:

应用程序试图在目标 UINavigationController 上推送一个 nil 视图控制器:0x7b98940.

这是当我单击"UITableViewController 的一个单元格时引起的.代码:

It is caused when I 'click' a cell of an UITableViewController. Code:

#pragma mark - Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    VerifyInfoViewController *verifyInfoVC = [self.storyboard instantiateViewControllerWithIdentifier:@"verifyInfoVC"];
    [self.navigationController pushViewController:verifyInfoVC animated:YES];
}

推荐答案

这个错误意味着你的 ViewController 没有被正确分配,我猜 self.storyboard 是 nil, 如果是,这意味着您没有初始化您的主 viewController,您可以执行以下技巧:

This error means your ViewController has not been allocated properly, and i guess self.storyboard is nil, If yes this means you didn't initialise your master viewController and you can do the below trick:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:[NSBundle mainBundle]];

这篇关于应用程序试图在目标上推送一个 nil 视图控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆