【问题标题】:app crashes after xib editxib 编辑后应用程序崩溃
【发布时间】:2010-11-16 13:01:30
【问题描述】:

我有一个导航控制器应用程序。我用 Xib 文件创建了一个 RootViewController 类。在那个 xib 文件中,我只有表格视图,仅此而已。我以程序方式创建的工具栏和工具栏上的按钮。表视图有数据源和委托文件所有者。

我删除了这个 xib 文件,并使用以前的名称创建了一个新文件。像 viewBased xib 文件一样创建它,然后我下拉到它的表格视图、工具栏、工具栏上的两个按钮。在它们上添加插座。都保存了。清除所有目标。全部建立。并运行。应用程序在启动时崩溃!有谁知道问题可能出在哪里?谢谢!

堆栈:

    [Session started at 2010-11-16 15:00:52 +0200.]
2010-11-16 15:00:53.729 PhoneBook[16210:207] ******* Accessibility Status Changed: On
2010-11-16 15:00:53.755 PhoneBook[16210:207] ********** Loading AX for: com.yourcompany.PhoneBook ************
2010-11-16 15:00:53.798 PhoneBook[16210:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "RootViewController" nib but the view outlet was not set.'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x02510b99 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x0266040e objc_exception_throw + 47
    2   CoreFoundation                      0x024c9238 +[NSException raise:format:arguments:] + 136
    3   CoreFoundation                      0x024c91aa +[NSException raise:format:] + 58
    4   UIKit                               0x0036aa40 -[UIViewController _loadViewFromNibNamed:bundle:] + 295
    5   UIKit                               0x00368675 -[UIViewController loadView] + 120
    6   UIKit                               0x004c1c8c -[UITableViewController loadView] + 80
    7   UIKit                               0x0036854f -[UIViewController view] + 56
    8   UIKit                               0x003669f4 -[UIViewController contentScrollView] + 42
    9   UIKit                               0x003767e2 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 48
    10  UIKit                               0x00374ea3 -[UINavigationController _layoutViewController:] + 43
    11  UIKit                               0x0037612d -[UINavigationController _startTransition:fromViewController:toViewController:] + 524
    12  UIKit                               0x00370ccd -[UINavigationController _startDeferredTransitionIfNeeded] + 266
    13  UIKit                               0x0048db55 -[UILayoutContainerView layoutSubviews] + 226
    14  QuartzCore                          0x0456a481 -[CALayer layoutSublayers] + 177
    15  QuartzCore                          0x0456a1b1 CALayerLayoutIfNeeded + 220
    16  QuartzCore                          0x045632e0 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 302
    17  QuartzCore                          0x04563040 _ZN2CA11Transaction6commitEv + 292
    18  UIKit                               0x002c104e -[UIApplication _reportAppLaunchFinished] + 39
    19  UIKit                               0x002c1477 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 545
    20  UIKit                               0x002cb3ec -[UIApplication handleEvent:withNewEvent:] + 1958
    21  UIKit                               0x002c3b3c -[UIApplication sendEvent:] + 71
    22  UIKit                               0x002c89bf _UIApplicationHandleEvent + 7672
    23  GraphicsServices                    0x02d6c822 PurpleEventCallback + 1550
    24  CoreFoundation                      0x024f1ff4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
    25  CoreFoundation                      0x02452807 __CFRunLoopDoSource1 + 215
    26  CoreFoundation                      0x0244fa93 __CFRunLoopRun + 979
    27  CoreFoundation                      0x0244f350 CFRunLoopRunSpecific + 208
    28  CoreFoundation                      0x0244f271 CFRunLoopRunInMode + 97
    29  UIKit                               0x002c0c6d -[UIApplication _run] + 625
    30  UIKit                               0x002ccaf2 UIApplicationMain + 1160
    31  PhoneBook                           0x00002494 main + 102
    32  PhoneBook                           0x00002425 start + 53
)
terminate called after throwing an instance of 'NSException'

【问题讨论】:

  • 您是否已正确连接所有内容?你连接视图了吗?我可以看看你的 .m 文件中的代码吗?
  • 谢谢!问题在于我没有将我的视图连接到文件所有者。我的文件所有者指向 NSObject 但不是我的班级。

标签: iphone xcode uinavigationbar xib


【解决方案1】:

* 由于未捕获的异常而终止应用程序 'NSInternalInconsistencyException', 原因:'-[UIViewController _loadViewFromNibNamed:bundle:] 加载了“RootViewController”笔尖,但 未设置查看出口。'

您的视图控制器失去了与视图插座的连接,您需要在 IB 中恢复它(就像您对所有插座所做的那样)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多