2

我收到以下错误:

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];
}
4

1 回答 1

22

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

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:[NSBundle mainBundle]];
于 2013-07-23T20:45:57.690 回答