debugging - How to debug "Collection was mutated while being enumerated" errors and like, when Xcode does not provide me with enough information? -


currently, see recurring error:

2013-04-18 02:35:51.583 aaah[1713:1110f] *** terminating app due uncaught exception 'nsgenericexception', reason: '*** collection <__nsarraym: 0x1fc00dc0> mutated while being enumerated.' 

in failing background queue (i see queues state upon moment of crash pressing command + 5) see:

0 _pthread_kill 1 pthread_kill 

and see assembly output don't understand.

i know how resolve kind of array enumeration errors - can't understand where/how should seek piece of code causing app crash.

i have multi-threaded code using afnetworking , core data, can't remember crucial section might be.

also, error occurs not always, time time, difficult use "isolation approach", isolating smaller , smaller pieces of code, identify buggy piece of code.

so question is:

how can extract more useful information output, or xcode can provide me more verbosity level, know how resolve annoying piece of code.

have tried setting exception breakpoint? debugger struggles exception handling inside blocks might help.

in breakpoints navigator (one of tabs on left side of window) click plus button @ bottom of window , select add exception breakpoint. hit done.

now when crash, debugger should hopefully put right before instant exception raised.

see http://developer.apple.com/library/mac/#recipes/xcode_help-breakpoint_navigator/articles/adding_an_exception_breakpoint.html more info.

edit:

based on feedback provided in comments, here's more analysis:

the exception application raising means attempted change collection type (in case, nsmutableorderedset) inside of enumeration block (in case, for-loop). looks you're trying remove objects in set looping over: [nsmutableorderedset removeobjectsinrange:inorderedset:]

to resolve should store ranges wish remove , actual removing once you're no longer iterating on set. it's still going difficult since, understand it, you're not breaking inside of objective-c code. should @ running threads in panel on left , @ method they're in. might give hint code wrong.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -