Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding a bug using Xcode - attempt to insert nil value

I am getting a random bug in my app, which is causing it to crash. The problem I am facing is XCode doesn't tell me where the crash is happening only the below information. Can someone tell me how I can find out where I might be able to find the problem within the code? It must be crashing at the same point as when the app does crash it always shows the below.

* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary setObject:forKey:]: attempt to insert nil value (key: 0)' * First throw call stack: (0x381e48bf 0x37d301e5 0x381e47b9 0x381e47db 0x381516bb 0x9237b 0x91121 0x8f0c5 0x8abc1 0x37b9d 0x8b68f 0x3550850f 0x381b0577 0x3813c0cf 0x3547c3fb 0x3547dc2b 0x8d005 0x3814322b 0x34495 0x32e31 0x3372d 0x30a59 0x3813e435 0x7b1df 0x7b88d 0x79e25 0x31ca650f 0x31ca5f01 0x31c8c4ed 0x31c8bd2d 0x37f12df3 0x381b8553 0x381b84f5 0x381b7343 0x3813a4dd 0x3813a3a5 0x37f11fcd 0x31cba743 0x89e8b 0x24a4) terminate called throwing an exception(lldb)

like image 924
Peter Avatar asked Nov 28 '22 14:11

Peter


1 Answers

Have you turned on exception breakpoints? Click the + at the bottom left of the Breakpoint Navigator, then select Add Exception Breakpont.

enter image description here

You can right click the breakpoint to edit it…

enter image description here

This will cause the code to stop at the point where the error occurs.

like image 104
Ashley Mills Avatar answered Nov 30 '22 02:11

Ashley Mills