设置 UINavigationController 时“无法对类型进行比较查询:(空)" [英] 'Cannot do a comparison query for type: (null)' when setting up UINavigationController
问题描述
我的应用在应用委托中崩溃了.
My app is crashing in the app delegate.
它抛出的错误是:
由于未捕获的异常NSInvalidArgumentException"而终止应用,原因:无法对类型进行比较查询:(空)"
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;
当它尝试运行最后一行时它会中断,将 rootViewController 设置为 navController.
It's breaking when it tries to run that last line, setting the rootViewController to the navController.
3 行 NSLog 的结果如下:
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.
推荐答案
我刚刚遇到了这个问题,这是因为我在 PFQuery 中执行了一个 equalTo:[PFUser currentUser]
但当时没有登录用户.
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.
这篇关于设置 UINavigationController 时“无法对类型进行比较查询:(空)"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!