self.rootViewController = [[RootViewController alloc] initWithNibName:nil bundle:nil];
[self.window addSubview:self.rootViewController.view]; //App will not crash without this line
self.navigationController = [[UINavigationController alloc] initWithRootViewController: self.rootViewController];
[self.window addSubview:self.navigationController.view];
我在模拟器中运行它,它崩溃了,为什么?
错误信息:
Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency',
reason: 'adding a root view controller <RootViewController: 0x6871620> as a child of
view controller:<UINavigationController: 0x6a86dc0>'
还是不知道