objective-c - '无法对类型 : (null)' when setting up UINavigationController 进行比较查询

标签 objective-c ios uinavigationcontroller

我的应用程序在应用程序委托(delegate)中崩溃。

它抛出的错误是:

由于未捕获的异常“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>>

对我来说似乎没有任何东西是空的,这就是我非常困惑的原因。

最佳答案

我刚遇到这个,这是因为我正在做 equalTo:[PFUser currentUser]在 PFQuery 中,但此时没有登录用户。

关于objective-c - '无法对类型 : (null)' when setting up UINavigationController 进行比较查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12965934/

相关文章:

ios - UINavigationController 在 popViewControllerAnimated 之后不释放/销毁 Controller ?

ios - 更改 UINavigationBar 背景图像并使 UINavigationBar 缩放

iphone - 我可以阻止单元格的披露指示器在被选中时变白吗?

ios - 我如何更改 View Controller 中的后退按钮标题,如下所示在 ios5 中使用 segue 推送

ios - Swift 2 从 url 变量加载图像错误

ios - UICollectionView 在 PerformBatchUpdates 上崩溃

ios - 弹出复杂导航路径到根的建议(路径包括多个嵌套的 UINavigationControllers 和模态覆盖)

objective-c - iOS : Passing Array of Core Data entities from Obj-C to Swift

ios - 在 WKWebView 中注入(inject)全局对象

objective-c - 有没有办法在不使用 UINavigationController 的情况下更改 iOS 中的 View ?