Question

In short, I'm an NSZombies noob. I JUST started trying to use them to debug with because, until now, I've been able to resolve all of my memory issues without them.

Right now, I'm getting...

[UIImage isKindOfClass:]: message sent to deallocated instance 0x8095f10

Is there a way to make that point to a line in my code? I mean, it's a big improvement over just getting a crash/bad access error, but that still only narrows it down to some sort of UIImage memory issue. Ideally, I would like it to say "the UIImage you created on line x of your y class was sent a isKindOfClass message after being deallocated."

Also, I'm pretty sure nowhere in my code am I using sending isKindOfClass to a UIImage in the first place. Does UIImage use that method somewhere inside its code?

edit: Updated tags. Accidentally had tags from an old question.

Was it helpful?

Solution

Run your app in the iOS simulator using Instruments and select the Zombie option.

Recreate the conditions that cause your issue and then you should be able to look at a reverse stack trace with system symbols hidden and it will take you right to the place in your code where the zombie was referenced. It might not tell you where it got deallocated, but it will certainly help you narrow down the scope of the error.

OTHER TIPS

As a noob myself, I'll just offer that I've seen this error with zombies turned on when I've failed to nillify my delegates before leaving a view controller. For example, if I have someObject.delegate = self I can avoid this error by setting someObject.delegate = nil in the viewWillDisappear.

Slap on an Exception breakpoint in Xcode and it will catch zombies (and more other exceptions, C++ and Objective-C) as it will preserve any state when an exception is raised without falling out of Objective-C scope and longjmp()'d out of all scopes into main().

This work on both simulator and device. I pretty much have this breakpoint on from I lay down the first line of code in any project.

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