【问题标题】:* Terminating app due to uncaught exception 'NSInternalInconsistencyException' in iOS* 由于 iOS 中未捕获的异常“NSInternalInconsistencyException”而终止应用程序
【发布时间】:2017-01-08 20:24:04
【问题描述】:
 *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', 
 reason: 'Could not load NIB in bundle: 
'NSBundle    </Users/xxxx/Library/Developer/CoreSimulator/Devices/726F2DC0-0653-4335-   93DD-40AFB9A00CB9/
data/Containers/Bundle/Application/3AD9B7CD-BB77-4676-B72D-D6504468A389/xxxx.app> (loaded)'
with name '1KQ-aR-y8O-view-UPI-Ak-bBq' 
and directory 'Main.storyboardc'' 
*** First throw call stack:
(
0   CoreFoundation                      0x000000010a90ee65 __exceptionPreprocess + 165
1   libobjc.A.dylib                     0x0000000109b12deb objc_exception_throw + 48
2   CoreFoundation                      0x000000010a90ed9d +[NSException raise:format:] + 205
3   UIKit                               0x0000000107dfa3cf -[UINib instantiateWithOwner:options:] + 499
4   UIKit                               0x0000000107bd3eea -[UIViewController _loadViewFromNibNamed:bundle:] + 381
5   UIKit                               0x0000000107bd4816 -[UIViewController loadView] + 178
6   UIKit                               0x0000000107bd4b74 -[UIViewController loadViewIfRequired] + 138
7   UIKit                               0x0000000107bdaf4f -[UIViewController __viewWillAppear:] + 120
8   UIKit                               0x0000000107c0ae44 -[UINavigationController _startCustomTransition:] + 1203
9   UIKit                               0x0000000107c1b23f -[UINavigationController _startDeferredTransitionIfNeeded:] + 712
10  UIKit                               0x0000000107c1c3af -[UINavigationController __viewWillLayoutSubviews] + 57
11  UIKit                               0x0000000107dc2ff7 -[UILayoutContainerView layoutSubviews] + 248
12  UIKit                               0x0000000107af54a3 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 703
13  QuartzCore                          0x000000010c24f59a -[CALayer layoutSublayers] + 146
14  QuartzCore                          0x000000010c243e70 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
15  QuartzCore                          0x000000010c243cee _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
16  QuartzCore                          0x000000010c238475 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277
17  QuartzCore                          0x000000010c265c0a _ZN2CA11Transaction6commitEv + 486
18  QuartzCore                          0x000000010c26637c _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
19  CoreFoundation                      0x000000010a83a367 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
20  CoreFoundation                      0x000000010a83a2d7 __CFRunLoopDoObservers + 391
21  CoreFoundation                      0x000000010a82ff2b __CFRunLoopRun + 1147
22  CoreFoundation                      0x000000010a82f828 CFRunLoopRunSpecific + 488
23  GraphicsServices                    0x000000010bd04ad2 GSEventRunModal + 161
24  UIKit                               0x0000000107a3e610 UIApplicationMain + 171
25  baajna                              0x000000010785e61f main + 111
26  libdyld.dylib                       0x000000010e92e92d start + 1
27  ???                                 0x0000000000000001 0x0 + 1
 )
 libc++abi.dylib: terminating with uncaught exception of type NSException

我在堆栈溢出中没有得到预期的答案..其他人问我尝试了他们所说的所有东西。但无法弄清楚我的问题。请大家帮我从盒子里拿出来。提前致谢

【问题讨论】:

  • 您能否提供一些代码如何创建您的UIViewController?以及你是如何在故事板中命名的?
  • 我又使用了 15 个 UIViewController,其中一些是 HomeController.h ArtisController.h AlbController.h 和 .m 文件。
  • 从故事板中删除视图并再次添加引用。有时它会在内存中保存一些引用...
  • 写下你可以发现这个崩溃的特定代码。可能是你的文件名不匹配。
  • 我检查了所有文件名..所有文件名都没有问题。当我启动我的应用程序时,它运行良好..在某些视图控制器访问后,它因提供的错误而崩溃

标签: ios objective-c xcode uinavigationcontroller storyboard


【解决方案1】:

如果您从故事板加载视图,那么您应该使用 storyboardobject.instantiateViewControllerWithIdentifier("StoryboardIdentifier")。据我所知,笔尖只能在单独的 XIB 上工作

【讨论】:

    【解决方案2】:

    如果你加载 Nib UIView。请按照以下步骤操作。

    打开 XCode 目标 -> 转到“构建阶段”选项卡 -> 单击“复制包资源”部分 -> 单击添加按钮 -> 添加缺少的 Nib 文件

    【讨论】:

      猜你喜欢
      • 2015-12-19
      • 1970-01-01
      • 2014-01-05
      • 2012-08-24
      • 2012-07-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多