I spent two days on it, and I still can not find the cause of the accident.
I know this has something to do with trying to access an object that has been freed, but I don't know what access or which object.
Whenever I try to find the source of EXC_BAD_ACCESS, people suggest using NSZombies. The problem is when I include zombies (either in xcode via an environment variable or in tools using ObjectAlloc properties), the program does not crash where it usually happens and the zombies do not report anything (nothing is displayed in the logs and nothing not marked in tools). Is something missing in NSZombie?
I tried to use some information from the xcode debugger and from ObjectAlloc in tools, but all the information is very mysterious and actually does not help me.
I installed a debugger to stop in objective-c exceptions. When this happens, it shows the call stack:
0 objc_msgSend 1 ?? 2 -[UITableViewCell removeFromSuperView] 3 -[UIView dealloc] ... etc ...
First of all, what is the deal with '1 ??'? What do question marks mean? Secondly, how can I find out where this was called in my code? All the operations described are too general (for example, UIView dealloc, but which UIView? And where?).
Also, when an exception occurs, it points to the assembly code, which again does not bring me any benefit if I do not spend hours trying to understand what the code does. I know some assembly, but there must be a better way ... right?
Is there a way to get meaningful information about what was the last line that was executed in my code before the exception occurred?
I tried to spray some NSLogs and breakpoints, but that doesn't help much because the crash happens after I pulled the view controller out of the navigation controller. Wherever I place breakpoints, breakpoints are reached accurate (I cannot find a breakpoint after the crash). This is only when I "continue" in the debugger that this is an exception. It is as if an accident occurred outside of my code, so I have no idea where to get the pen.
I looked at my code and double-checked that I adhered to all the rules of memory management (at least as far as I know). I am sure this is something very subtle, but I cannot find it.
If anyone has ideas on how to find such errors without NSZombie, please share.
Thanks.