1
votes

I am a second year Computer Programming student who is working on a program in Objective C. (Xcode, if it matters). Right now, we are working on animation and moving animated objects across the screen. Right now, I am dealing with an error that is driving me insane. My program is using ARC, Automated Reference Counting, which supposedly is supposed to help with memory management. However, for some reason, I can't seem to use

[super dealloc]; 

It always gives me an error that says "ARC forbids explicit message send of 'dealloc'

Why is this? How do I fix it? It works in my other programs, just not this one?

Also, release doesn't seem to work either. For example, the following code gives me 2 errors: [fireBall release];

The error says "'release' is unavailable: not available in automatic reference counting mode" and the next error says "ARC forbids explicit message send of 'release'." Why does this happen, how can I fix it? This code works in my other programs. Can someone please explain, or at least provide a link that can solve all my problems? Thanks for reading

3

3 Answers

3
votes

You should take some time to fully go through Apple's Guide on ARC

It will save you tons of time and it's something definitely worth understanding.

2
votes

You can define your own dealloc method, you just cant call [super dealloc] (ARC calls it automatically). The same is true for release, you dont need to call it as ARC handles placing it in your code

0
votes

Simple, just remove that line. ARC takes care of all release/autorelease/dealloc calls. ARC has 100% (pretty much) insight in the lifetime of your objects and inserts these calls for you.

You can still override the dealloc method to do some cleanup though.