Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 898
Mike Stein Avatar asked Nov 27 '22 14:11

Mike Stein


1 Answers

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.

like image 70
z8000 Avatar answered Dec 05 '22 13:12

z8000