viewDidUnload and dealloc methods with ARC

In a nutshell:

1. you should rarely need a dealloc method. You do not have to (and indeed can’t) release¬†instance variables

2. and viewDidUnload is deprecated

From “Transitioning to ARC Release Notes”

http://developer.apple.com/library/ios/#releasenotes/ObjectiveC/RN-TransitioningToARC/Introduction/Introduction.html

“Custom dealloc methods in ARC do not require a call to [super dealloc] (it actually results in a compiler error). The chaining to super is automated and enforced by the compiler.

You create objects using alloc; the runtime takes care of deallocating objects.”

See also:

http://stackoverflow.com/questions/7292119/custom-dealloc-using-arc-objective-c

and

http://stackoverflow.com/questions/12630611/are-dealloc-and-viewdidunload-methods-still-required-when-using-arc-pre-ios

Leave a Reply

Your email address will not be published. Required fields are marked *