Question

I have a crash that is happening deep within UIKit for some reason; an EXC_BAD_ACCESS error is happening something like 8 calls deep into a dismissModalViewController call. I tried enabling NSZombieEnabled for my executable, but the console log prints the same error regardless of whether or not zombies are turned on and i don't know which object is causing the issue. Is there something i'm missing that i need to do to get the console to print the correct information?

Was it helpful?

Solution

Read about using Zombies here.

Run this in gdb. When you get the EXC_BAD_ACCESS look at the stack at that point (use gdb's where command or run the Xcode GUI debugger). If you are still having issues, post the stack in your original question.

Also zombies will only help you if you're dealing with NSObjects. If you're using low level malloc/free routines zombies buy you nothing for those allocations.

OTHER TIPS

One thing I learned last weekend when NSZombieEnabled didn't seem to be working at all - make sure you're not passing in a non-object to some code.

In my case, I was returning an NSString as just "string" instead of @"string". That meant I was overwriting an NSString object with the c-string. When I later tried to write a new value in that object I was getting a BAD_ACCESS. NSZombie's couldn't help b/c it was not an object I was trying to overwrite, but that c-string.

As an aside, treat all warnings as errors in XCode - wish I could make them show up in RED in the IDE GUI - they are easy to miss sometimes.

Sounds like something is over-released in your Modal View Controller. Start by commenting out newish lines until it stops breaking.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top