'设置UINavigationController时,不能对类型:(null)'进行比较查询

Mik*_*ein 4 objective-c uinavigationcontroller ios

我的应用程序崩溃在应用程序委托中.

它抛出的错误是:

由于未捕获的异常'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;
Run Code Online (Sandbox Code Playgroud)

当它试图运行最后一行时,它会断开,将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>>
Run Code Online (Sandbox Code Playgroud)

对我来说看起来没有任何东西是空的,这就是为什么我非常困惑.

z80*_*000 28

我刚刚碰到这个,这是因为我equalTo:[PFUser currentUser]在PFQuery中做了一个事实,但那时没有登录用户.