In xcode 4.2 I have found it very frustrating because you can't use:
-(void)dealloc {
[label release]; //'release' is unavailable
[super dealloc]; //'dealloc' is forbidden in automatic reference counting
}
Is there another way because autorelease and other deallocs don't work either.
Xcode 4.2 introduces "Automatic Reference Counting" (aka ARC). This is a compiler feature that basically inserts the retain and release calls for you. Under ARC, if you have a pointer to an object, you're retaining it. When your pointer goes out of scope, or is reassigned to point to another object, the original object is released. It's really nice.
So, in short, you just remove all the calls to retain
, release
, and autorelease
, and the compiler will do the right thing for you.
Read up on Automatic Reference Counting. If you write your code properly, you don't need to do any of that anymore.
If you want to use old code without converting, disable ARC. put -fno-objc-arc
in the compiler flags for any source modules you don't want to use ARC.
joe
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With