【问题标题】:Objective C++, SIGABRT signal目标 C++,SIGABRT 信号
【发布时间】:2014-08-28 07:10:11
【问题描述】:

我正在从本教程 http://hubpages.com/hub/Tutorial-on-Creating-an-IOS-5-SQLite-Database-Application-IOS-5-SQLite 做一个 iOS 应用程序(实际上只是复制代码) 而且我无法运行我的应用程序。构建成功,然后我在 XCode 中收到信号 SIGABRT

2014-08-28 09:04:40.105 Whine2[526:60b] Problem with prepare statement 2014-08-28 09:04:40.109 Whine2[526:60b] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array' *** First throw call stack: ( 0 CoreFoundation 0x018d81e4 __exceptionPreprocess + 180 1 libobjc.A.dylib 0x016578e5 objc_exception_throw + 44 2 CoreFoundation 0x018793f6 -[__NSArrayM objectAtIndex:] + 246 3 Whine2 0x000029bd -[kcbViewController viewDidLoad] + 269 4 UIKit 0x0043633d -[UIViewController loadViewIfRequired] + 696 5 UIKit 0x004365d9 -[UIViewController view] + 35 6 UIKit 0x00356267 -[UIWindow addRootViewControllerViewIfPossible] + 66 7 UIKit 0x003565ef -[UIWindow _setHidden:forced:] + 312 8 UIKit 0x0035686b -[UIWindow _orderFrontWithoutMakingKey] + 49 9 UIKit 0x003613c8 -[UIWindow makeKeyAndVisible] + 65 10 UIKit 0x00311bc0 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 2097 11 UIKit 0x00316667 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 824 12 UIKit 0x0032af92 -[UIApplication handleEvent:withNewEvent:] + 3517 13 UIKit 0x0032b555 -[UIApplication sendEvent:] + 85 14 UIKit 0x00318250 _UIApplicationHandleEvent + 683 15 GraphicsServices 0x038cdf02 _PurpleEventCallback + 776 16 GraphicsServices 0x038cda0d PurpleEventCallback + 46 17 CoreFoundation 0x01853ca5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53 18 CoreFoundation 0x018539db __CFRunLoopDoSource1 + 523 19 CoreFoundation 0x0187e68c __CFRunLoopRun + 2156 20 CoreFoundation 0x0187d9d3 CFRunLoopRunSpecific + 467 21 CoreFoundation 0x0187d7eb CFRunLoopRunInMode + 123 22 UIKit 0x00315d9c -[UIApplication _run] + 840 23 UIKit 0x00317f9b UIApplicationMain + 1225 24 Whine2 0x0000282d main + 141 25 libdyld.dylib 0x01e21701 start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

我知道数组有问题,对吧?

【问题讨论】:

    标签: ios objective-c xcode xcode5


    【解决方案1】:

    正如链接中的错误消息和代码所说,viewDidLoadkcbViewController 中有一个名为 wines 的数组,它是空的。 a只需在访问数组wines 之前对其进行记录。如果需要检查数组是否为空,可以检查self.wines.count是否为0。

    【讨论】:

      猜你喜欢
      • 2011-09-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-08
      • 2017-10-30
      • 1970-01-01
      • 2021-08-08
      相关资源
      最近更新 更多