我收到以下错误:
Application tried to push a nil view controller on target UINavigationController: 0x7b98940.
当我'点击'UITableViewController
的单元格时会导致此错误。
代码:
#pragma mark - Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
VerifyInfoViewController *verifyInfoVC = [self.storyboard instantiateViewControllerWithIdentifier:@"verifyInfoVC"];
[self.navigationController pushViewController:verifyInfoVC animated:YES];
}
答案 0 :(得分:21)
此错误表示您的ViewController
未正确分配,我猜self.storyboard
为零,如果是,则表示您没有初始化您的主viewController
,您可以执行以下技巧:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:[NSBundle mainBundle]];