Help, I\'ve been hacking at this for weeks now! I have this app I am developing in the Simulator, and I have done a lot of the UI stuff, it is just getting to the interesting pa
you will want to enable zombie objects in your code, and Checking Autoreleased objects, and perhaps enabling debugging will help.
I added three Environment Variables.
all of these are set to YES
here is a link with the path I took.
http://www.codza.com/how-to-debug-exc_bad_access-on-iphone
if you are using XCode 4 then you will add these in the Arguments section of the Edit Schemes popover.
Another thing to note is, you should only release or autorelease objects that you are retaining. You maintain a retain on the following objects.
if you send an autorelease to any object other than these, you could randomly end up with this and other errors.
commonly I release objects and then set them to nil, that way if i release them later, I wont have any issue because if you autorelease nil, you get nil.
NSObject *myObject = [incomingObject retain];
// Do something with the object.
[myObject autorelease];
[myObject autorelease]; // This line will end in an error down the line when the object is released past 0, or when the release pool is drained.
myObject = nil;
[myObject release]; // This line will do nothing. no error, no effect.
The most likely cause is adding a garbage or already freed object to the Autorelease pool - maybe in that PurpleEventCallback
function?