【问题标题】:Getting SIGABRT for a reason unknown to me出于我不知道的原因获得 SIGABRT
【发布时间】:2011-11-05 11:47:09
【问题描述】:

我正在开发一个 iOS 应用程序 (http://affogato.visioa.com/),它实现了一个标签栏控制器、导航控制器和一个 tableview 控制器,每次我运行我的应用程序时,我都会得到:“线程 1:程序收到的信号:“SIGABRT”。谁能解释我为什么会收到这个以及如何纠正它?

下面是控制台:

2011-08-28 13:13:57.070 Affogato[16469:b303] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "CoffeesView" nib but didn't get a UITableView.'
*** Call stack at first throw:
(
0   CoreFoundation                      0x00dc95a9 __exceptionPreprocess + 185
1   libobjc.A.dylib                     0x00f1d313 objc_exception_throw + 44
2   CoreFoundation                      0x00d81ef8 +[NSException raise:format:arguments:] + 136
3   CoreFoundation                      0x00d81e6a +[NSException raise:format:] + 58
4   UIKit                               0x00224e9b -[UITableViewController loadView] + 275
5   UIKit                               0x000cb00e -[UIViewController view] + 56
6   UIKit                               0x000c9482 -[UIViewController contentScrollView] + 42
7   UIKit                               0x000d9f25 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 48
8   UIKit                               0x000d8555 -[UINavigationController _layoutViewController:] + 43
9   UIKit                               0x000d9870 -[UINavigationController _startTransition:fromViewController:toViewController:] + 524
10  UIKit                               0x000d432a -[UINavigationController _startDeferredTransitionIfNeeded] + 266
11  UIKit                               0x001ef2e9 -[UILayoutContainerView layoutSubviews] + 226
12  QuartzCore                          0x016b3a5a -[CALayer layoutSublayers] + 181
13  QuartzCore                          0x016b5ddc CALayerLayoutIfNeeded + 220
14  QuartzCore                          0x0165b0b4 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310
15  QuartzCore                          0x0165c294 _ZN2CA11Transaction6commitEv + 292
16  UIKit                               0x0001d9c9 -[UIApplication _reportAppLaunchFinished] + 39
17  UIKit                               0x0001de83 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 690
18  UIKit                               0x00028617 -[UIApplication handleEvent:withNewEvent:] + 1533
19  UIKit                               0x00020abf -[UIApplication sendEvent:] + 71
20  UIKit                               0x00025f2e _UIApplicationHandleEvent + 7576
21  GraphicsServices                    0x01002992 PurpleEventCallback + 1550
22  CoreFoundation                      0x00daa944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
23  CoreFoundation                      0x00d0acf7 __CFRunLoopDoSource1 + 215
24  CoreFoundation                      0x00d07f83 __CFRunLoopRun + 979
25  CoreFoundation                      0x00d07840 CFRunLoopRunSpecific + 208
26  CoreFoundation                      0x00d07761 CFRunLoopRunInMode + 97
27  UIKit                               0x0001d7d2 -[UIApplication _run] + 623
28  UIKit                               0x00029c93 UIApplicationMain + 1160
29  Affogato                            0x00001ed9 main + 121
30  Affogato                            0x00001e55 start + 53
31  ???                                 0x00000001 0x0 + 1
)
terminate called throwing an exception

【问题讨论】:

  • 你能把你的tableview类的代码贴出来吗?

标签: iphone cocoa-touch debugging sigabrt


【解决方案1】:

控制台日志的第一行给出了 SIGABRT 的原因:

2011-08-28 13:13:57.070 Affogato[16469:b303] *** 终止应用程序 由于未捕获的异常“NSInternalInconsistencyException”, 原因:'-[UITableViewController loadView] 加载了“CoffeesView”笔尖,但没有得到 UITableView。

如果您打算使用 UITableViewController,它会在 NIB 文件中查找要控制的 UITableView - 那里有吗?

另一方面,如果您不打算使用这种控制器,只需将其更改为 .h 文件中的 UIViewController 即可。

【讨论】:

    【解决方案2】:

    我收到了相同的错误消息,在我的情况下,表格视图的“视图”出口未连接到情节提要场景中。控制从 ViewController 对象拖动到场景中嵌入的 UITableView 对象。 HTH。

    【讨论】:

      【解决方案3】:

      故事板也有同样的问题。解决方案非常简单,在故事板中,我使用 UIViewController 类作为我的视图控制器场景,实际上应该是 UITableViewController。我刚刚删除了我的UIViewController 场景并创建了新的UITableViewController 场景,错误就消失了。

      如果您使用情节提要,我很确定您会遇到同样的问题。如果您不使用情节提要,请确保您在 XIB 中设置的类名应为 UITableViewController 或您的自定义类必须继承 .h 文件中的 UITableViewController 并确保您的视图出口设置为您的控制器。

      【讨论】:

        【解决方案4】:

        如果您使用情节提要,也会发生此错误。

        如果您使用故事板将项目作为通用应用程序启动,然后在 iPad 上运行应用程序时将项目更改为仅在手机中支持,您可能会看到此错误。

        要修复它,暂时将项目改回通用并将 iPad 故事板设置为使用 iPhone,然后将您的项目设置回 iPhone。

        仅供参考

        【讨论】:

          【解决方案5】:

          我认为你应该改变:

          [coffeeTypesArray objectAtIndex:row]
          

          [coffeeTypesArray objectAtIndex:indexPath.row]
          

          【讨论】:

            猜你喜欢
            • 2015-07-24
            • 2021-07-06
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2022-11-01
            • 1970-01-01
            • 2021-03-11
            相关资源
            最近更新 更多