In iOS 6 viewWillUnload and viewDidUnload Are Deprecated

October 15, 2012

Prior to iOS 6, in low memory conditions iOS would call viewWillUnload and viewDidUnload before releasing unneeded views from memory. Apple has determined that the memory captured was not worth the overhead and additional issues caused by using these methods.

Beginning in iOS 6, viewWillUnload and viewDidUnload are deprecated, as views are no longer removed from memory if the OS runs low on the same. Put another way, if your app targets iOS 6, these methods will not be called.

Apple recommends code that you had in these methods should be reviewed, and if needed, moved to dealloc, viewWillDisappear or viewDidDisappear.

Interesting note, Apple mentioned at WWDC 2012 that they fixed a whole class of application crashes by removing the calls to viewWillUnload and viewDidUnload.

Good to know that Apple continually reviews their API’s and sometimes an update equals removing code.