问题
I recently had my xcode upgraded to version 4, and I have an EXC_BAD_ACCESS exception
in my code, but despite setting NSZombieEnabled
in the environment it's still showing the break point on the thread1, int retVal = UIApplicationMain(argc, argv, nil, nil);
line.
I'm sure I had this configured in XCode 3 to stop on the line of my code that was causing the exception. Now it doesn't do that and displays no error messages in the GDB window either.
Does anyone know what I might be missing?
Thanks Ray
回答1:
EXC_BAD_ACCESS is not an exception, at least not as far as breakpoints are concerned - it means the code is trying to call a method on an object that does not exist anymore, because you released it.
The easiest way to find this in XCode4 is to run Instruments (Cmd-I), and in the dialog that pops up asking you which instrument to use, choose "Zombies". Then do whatever to cause the crash, and you will see a dialog pop up with "Zombie Messaged". Click on the little arrow and you will get a history of what created, retained, or released the object. Then you can figure out who released the object early.
来源:https://stackoverflow.com/questions/5605548/xcode-4-not-breaking-on-correct-line-on-exc-bad-access