'Cannot do a comparison query for type: (null)' when setting up UINavigationController

自作多情 提交于 2020-01-03 16:00:39

问题


My app is crashing in the app delegate.

The error it's throwing is:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Cannot do a comparison query for type: (null)'

My code is below. I've left the logging statements in so you can see where I've been checking things:

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;

It's breaking when it tries to run that last line, setting the rootViewController to the navController.

The results from the 3 NSLog lines are as follows:

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>>

It doesn't look like anything is null to me, which is why I'm extremely confused.


回答1:


I just ran into this and it was due to the fact that I was doing an equalTo:[PFUser currentUser] in a PFQuery but there was no logged-in user at that point.




回答2:


This really wound up being a question about "how do I get more information out of a crash log". rmaddy's comment pointed me in the right direciton.

Sean's answer here sorted me out.



来源:https://stackoverflow.com/questions/12965934/cannot-do-a-comparison-query-for-type-null-when-setting-up-uinavigationcont

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!