I wrote code to generate a crash of index out of bound.
Following is the exception thrown.
2017-01-07 04:02:57.606 testABC[1694:52966] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSSingleObjectArrayI objectAtIndex:]: index 1 beyond bounds [0 .. 0]'
*** First throw call stack:
(
0 CoreFoundation 0x000000010e85cd4b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010e2be21e objc_exception_throw + 48
2 CoreFoundation 0x000000010e8b5c2f -[__NSSingleObjectArrayI objectAtIndex:] + 111
3 testABC 0x000000010dce962d -[ViewController ComplexFunction] + 61
4 testABC 0x000000010dce95db -[ViewController thirdFunction] + 43
5 testABC 0x000000010dce959b -[ViewController secondFunction] + 43
6 testABC 0x000000010dce955b -[ViewController firstFinction] + 43
7 testABC 0x000000010dce96c2 -[ViewController viewDidAppear:] + 50
8 UIKit 0x000000010ee28a6c -[UIViewController _setViewAppearState:isAnimating:] + 945
9 UIKit 0x000000010ee2b7da __64-[UIViewController viewDidMoveToWindow:shouldAppearOrDisappear:]_block_invoke + 42
10 UIKit 0x000000010ee29ac4 -[UIViewController _executeAfterAppearanceBlock] + 86
11 UIKit 0x000000010ec8d77c _runAfterCACommitDeferredBlocks + 653
12 UIKit 0x000000010ec7a273 _cleanUpAfterCAFlushAndRunDeferredBlocks + 566
13 UIKit 0x000000010ec9d757 __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke_2 + 194
14 CoreFoundation 0x000000010e8016ac __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
15 CoreFoundation 0x000000010e7e66f4 __CFRunLoopDoBlocks + 356
16 CoreFoundation 0x000000010e7e5e65 __CFRunLoopRun + 901
17 CoreFoundation 0x000000010e7e5884 CFRunLoopRunSpecific + 420
18 GraphicsServices 0x00000001126d9a6f GSEventRunModal + 161
19 UIKit 0x000000010ec80c68 UIApplicationMain + 159
20 testABC 0x000000010dce99df main + 111
21 libdyld.dylib 0x000000011174968d start + 1
22 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
If you read carefully the First Throw call stack
0 CoreFoundation 0x000000010e85cd4b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010e2be21e objc_exception_throw + 48
0 and 1
are the system processes after crash.
2 CoreFoundation 0x000000010e8b5c2f -[__NSSingleObjectArrayI objectAtIndex:] + 111
2
is the line which caused the exception.
3 testABC 0x000000010dce962d -[ViewController ComplexFunction] + 61
3
tells you that Class name (ViewController
) and function naem (ComplexFunction
) in which exception was thrown.