Reputation: 117
Is there some method to understand what of my 20 Arrays is empty when I get this problem?
2012-12-06 16:52:05.409 Posizione Corrente 3[3738:907] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array'
*** First throw call stack:
(0x383042a3 0x34adb97f 0x3824fb75 0x560ab 0x38a49545 0x38a2e30b 0x38a457c7 0x38a01803 0x3bed7d63 0x3bed7901 0x3bed8835 0x3bed821b 0x3bed8029 0x3bed7e89 0x382d96cd 0x382d79c1 0x382d7d17 0x3824aebd 0x3824ad49 0x340232eb 0x38a522f9 0x7c675 0x3940bb20)
libc++abi.dylib: terminate called throwing an exception
(lldb)
Upvotes: 0
Views: 82
Reputation: 31016
If you set a breakpoint on Objective-C exceptions using Xcode's Breakpoint Navigator, the program should stop when it encounters that error and show you the code that caused it. From the line of code, it should be reasonably easy to see which array is implicated.
Upvotes: 1
Reputation: 46543
You can check with the following code, if you array contains any value or not.
if([myArray count]==0){
//do this
}
else{
//do you array manipulation
}
Upvotes: 0