应用程序试图推动一个零视图控制器的目标

我得到了以下错误:

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

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

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