2014-08-28 169 views
-1

我可是從本教程http://hubpages.com/hub/Tutorial-on-Creating-an-IOS-5-SQLite-Database-Application-IOS-5-SQLite 做iOS應用程序(實際上只是複製的代碼),我無法運行我的應用程序。建立成功,然後在我的XCode中獲得信號SIGABRT目的C++,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)

我知道有一些問題陣列,對不對?

回答

0

由於您的錯誤消息和鏈接中的代碼說,的viewDidLoad中有一個名爲wines的數組,它是空的。 a在訪問之前記錄數組wines。如果您需要檢查數組是否爲空,則可以檢查self.wines.count是否爲0.