viewDidUnload was generated with ivars set to nil


When I looked at the generated code for viewDidUnload, all the instance variables had been set to nil as quoted in the book. Is this a change that Apple have made in Xcode since the book was written or will it be the case that in some situation they will be set to nil and in other situations not?

Also the dealloc method had been created automatically.


Yes, that change was made around the time we were releasing the book.

This will not be the case anymore, since viewDidUnload and dealloc are no longer used with ARC.

(viewDidUnload is used, but all outlets should be “weak” now so they automatically become nil when the view is unloaded… therefore, with ARC, if you declare your outlets as weak, you do not have to set them to nil in viewDidUnload).