If your app crashes for strange reasons


I was stumped - my DrawingFun app was crashing in some really strange ways. In one case, the BezierPath was reporting itself as an NSString, other was just bad memory access errors. Copying and pasting code from the web did not fix it.

Finally, I realized I had not checked “Use ARC” when I created the project. Argh. Turning it on fixed everything.

I’ve gotten lazy with memory errors thinking ARC “fixes all”†. The errors should have clued me in, but I was looking in the wrong place.

If you don’t have ARC turned on, this app (and probably others) misbehaves.


†Yes, I know, this overstates the case; but for a beginner with Cocoa, I’m hard-pressed to get head around other things and leaving ARC on for the moment frees that part of my brain up.


Thanks for that hint. I’ve been perplexed.

But how should the code be written without ARC or autorelease pools? I can’t figure that out.


ARC doesn’t need autorelease pools NOR will XCode let you use release or dealloc whilst ARC is enabled :slight_smile: