【问题标题】:Unfortunately terminating app due to uncaught exception?由于未捕获的异常而不幸终止应用程序?
【发布时间】:2014-05-05 06:19:49
【问题描述】:

我正在开发一个包含多个 xib 文件的示例应用程序并尝试进行导航,不幸的是应用程序崩溃了,第一个视图到第二个视图

* 由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因:“无法在包中加载 NIB:“NSBundle(已加载)”,名称为“ViewController”

是什么原因?我使用的一些代码:

#import "ViewController.h"   /*current view*/
#import "secondViewController.h"  /*view for navigate*/

-(void)navigation{
     secondViewController *desController=[[secondViewController alloc]initWithNibName:@"ViewController" bundle:nil];
     [self presentViewController:desController animated:YES completion:nil];
}

【问题讨论】:

标签: ios


【解决方案1】:

我认为您在导致错误的 initWithNibName:@"ViewController" 中传递了错误的名称。

【讨论】:

  • 是的,只是笔尖名称错误,感谢指导
【解决方案2】:

根据崩溃日志,笔尖名称有问题。而不是oneViewControllerl,笔尖名称可能是oneViewController。检查 nib(xib) 文件并修正正确的 nib 名称。

【讨论】:

    【解决方案3】:

    交叉检查您是否设置了正确的 Nib 名称而不是 ViewController

    secondViewController *desController=[[secondViewController alloc]initWithNibName:@"ViewController" bundle:nil];
    

    【讨论】:

      猜你喜欢
      • 2015-08-20
      • 2014-11-03
      • 2014-01-05
      • 2015-09-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多