I have big project with async event, and sometimes i have error [__NSArrayM insertObject:atIndex:]: object cannot be nil, but I havent idea where is throwing this error.. How can I catch this error? I make assert in everywhere where I make operation insertobject:atIndex and nothing..
This is stack:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(0x34c352a3 0x32f4597f 0x34b7f8d9 0xc48db 0xc3ced 0xc3b41 0x1178d9 0x148aed 0x103cfd 0x102fc9 0x101f95 0x35f25595 0x35f7a13b 0x35f7a081 0x35f79f65 0x35f79e89 0x35f795c9 0x35f794b1 0x35f67b93 0x35f67833 0xd820b 0x35fc8275 0x3604aea9 0x326efa6f 0x34c0a5df 0x34c0a291 0x34c08f01 0x34b7bebd 0x34b7bd49 0x350b82eb 0x35f5a301 0x62e45 0x62de0)
libc++abi.dylib: terminate called throwing an exception
A good way to check where your code is crashing is:
1) goTo the breakpoint tab in Xcode.
2) click on the '+" button at the bottom.
3) Add Exception Breakpoint
a) In the break tab select both:
i) on Throw
ii) on Catch
and build and r un.
4) These breakpoints will give you exactly where your app is crashing 90% of the times.
Hope this helps you in someway. :)