1

In this game, once the player dies, all of the variables are reinitialized and a tap-to-play label should appear. Instead, the app crashes with the following message:

Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array

So, that seems pretty self-explanatory, however, I haven't been able to narrow the crash down to any single array using breakpoints. In fact, everything seems to be reinitialized just fine. But somewhere between that point and being able to restart the game is where the crash occurs.

I guess my question is, how do I find a bug that doesn't seem to be tied to any particular code - even though it obviously is?

I'm not including code because I don't want a fix for this one problem - I'm more interested in learning how to uncover the problem. Thanks!

Here is the stack trace where the error occurs. FWIW!

libsystem_kernel.dylib`__pthread_kill:
    0x182db42e0 <+0>:  mov    x16, #0x148
    0x182db42e4 <+4>:  svc    #0x80
->  0x182db42e8 <+8>:  b.lo   0x182db4300               ; <+32>
    0x182db42ec <+12>: stp    x29, x30, [sp, #-0x10]!
    0x182db42f0 <+16>: mov    x29, sp
    0x182db42f4 <+20>: bl     0x182d94bdc               ; cerror_nocancel
    0x182db42f8 <+24>: mov    sp, x29
    0x182db42fc <+28>: ldp    x29, x30, [sp], #0x10
    0x182db4300 <+32>: ret   
squarehippo10
  • 1,855
  • 1
  • 15
  • 45
  • 1
    Usually, the stack-trace from the crash has some information about where the crash happened. Could you post the stack-trace? – aksh1t Mar 14 '18 at 20:48
  • 1
    You can try to set exception breakpoint as described here: https://stackoverflow.com/a/34187379/1236218 – Dan Karbayev Mar 14 '18 at 20:50
  • The exception breakpoint helped me figure out that the problem was tied to a reported bug in SceneKit - so thank you @DanKarbayev! – squarehippo10 Mar 16 '18 at 18:05

0 Answers0