Xcode4 settings are not the same: find arguments in edit-> Scheme (in xcode 4.2, choose product-> edit Scheme)
Set the following three values to yes.
NtutoreleasefreedobjectCheckenabled
Nszombieenabled
Nsdebugenabled
Also reprinted 2 debugging exc_bad_access good article http://blog.zol.com.cn/2387/article_2386505.html
Http://www.cnblogs.com/likwo/archive/2011/02/28/1967066.html
This is also true for foreigners: I had similar issue; turns out I was
Not retaining a uibutton properly. how I found the cause: -Enable zombies-run the project with 'location' instruments-use the app to trigger the bug-check that instruments show message 'zombie messaged' on the timeline-There shocould be a link that
Opens calayer details: when it was allocated and deallocated-you are interested in the place where is was allocated, shocould be that aha !!! Place in your code
I use zombies on the simulator, and then run the program. When the program crashes, there will be a crash point and code.
To another article:
Method 1:
Paeholdtranmaincontrol * control = [[paeholdtranmaincontrol alloc] init];
[Self. navigationcontroller pushviewcontroller: Control animated: Yes];
[Control release];
Alloc has a control and release, and the running will crash. No prompt is displayed. Only exc_bad_access is displayed on the console.
Use the nszombieenabled parameter and the mallocstacklogging parameter to display-[calayer release]: Message sent to deallocated instance 0x13570810
After a long time, I used the following methods to locate the problem:
Open Instrument --> IOS simulator:
Select All -- "zombies to run. When disconnected, view the stack trace to track
Method 2: for example, the output in the console is as follows:
Testapp [1472: 207] ***-[nsobject release]: Message sent to deallocated instance 0x6019170
In the GDB Console, run shell malloc_history <pid> <mem_address>
PID = process ID (e.g. 1472)
Mem_address = memory address of instance (e.g. 0x6019170)
The call stack is displayed.