viewDidUnload no longer called in ios6

Martin picture Martin · Sep 20, 2012 · Viewed 19.3k times · Source

I just installed the new version of Xcode/ios6. viewDidUnload is now depreciated.

In the apple doc,

viewDidUnload [...] Deprecated in iOS 6.0. Views are no longer purged under low-memory conditions and so this method is never called.

But numbers of apps are using this callback to release their properties, like :

- (void)viewDidUnload {
    [super viewDidUnload];

    self.recipientButton = nil;
    self.connectButton = nil;
    self.infoLabel = nil;
}

This was the best practice to release your IBOutlets.

So, first question:
What is going to happen these existing apps in iOS 6? Will they leak ?

and second one:
What is the new recommended way to release an IBOutlet property ? In dealloc method ?

Answer

Pranav Jaiswal picture Pranav Jaiswal · Sep 20, 2012

For the first Question:

Your ViewController will receive didReceiveMemoryWarning method callback and you can nil out the view & other components in this method

For Reference Do Check WWDC 2012 video Session on EVOLUTION OF VIEW CONTROLLER, in case you haven't (I Believe they are available only for registered developers, but not sure).

Answer to your second one.

[object release]; in dealloc. No need to assign nil to object before releasing.