问题
I got the below error:
Application tried to push a nil view controller on target UINavigationController: 0x7b98940.
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];
}
回答1:
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]];
来源:https://stackoverflow.com/questions/17819826/application-tried-to-push-a-nil-view-controller-on-target