我的应用程序在应用程序委托中崩溃。
它抛出的错误是:
由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“无法对类型进行比较查询:(null)”
我的代码如下。我已将日志记录保留在其中,因此您可以看到我一直在检查的地方:
self.viewController = [[ParseStarterProjectViewController alloc] initWithNibName:@"ParseStarterProjectViewController" bundle:nil];
NSLog(@"View controller is %@",self.viewController);
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:self.viewController];
NSLog(@"Nav controller is %@",navController);
NSLog(@"Self window is %@",self.window);
self.window.rootViewController = navController;
当它尝试运行最后一行时,它会中断,将 rootViewController 设置为 navController。
3 NSLog 行的结果如下:
View controller is <ParseStarterProjectViewController: 0x1fda0770>
Nav controller is <UINavigationController: 0x1fda1390>
Self window is <UIWindow: 0x1fd97c90; frame = (0 0; 320 480); opaque = NO; autoresize = RM+BM; layer = <UIWindowLayer: 0x1fd97d90>>
对我来说似乎没有什么是空的,这就是为什么我非常困惑。