automatic ref counting - Objective-C destructor with ARC -
i'm trying create cleanup code in objective-c class, overwriting dealloc:
-(void)dealloc { //cleanup code [super dealloc]; } though cannot since [super dealloc] disallowed compiler when arc enabled. there alternative can use?
from transitioning arc release notes (emphasis mine):
you may implement dealloc method if need manage resources other releasing instance variables. not have (indeed cannot) release instance variables, may need invoke [systemclassinstance setdelegate:nil] on system classes , other code isn’t compiled using arc.
custom dealloc methods in arc do not require call [super dealloc] (it results in compiler error). chaining super automated , enforced compiler.
so can same sort of cleanup in dealloc when using arc, don't call super.
Comments
Post a Comment