In the Xcode templates for iOS apps such as the 'View Based Application', a MainWindow nib is created with contains three top-level objects: The App Delegate, the Window, and the main View Controller. The App Delegate defines retain
outlets/accessors for both the window and the view controller. I don't understand why the App Delegate would need to retain these objects since they are already top-level objects in the nib and therefore should have been retained by UIApplication. Checking the retainCount
of these objects sure enough shows 1
for the app delegate and 2
for the window and view controller. Could I/should I change these to assign
instead?
I know this is a nit picky thing but I'm hoping that understanding why this is done will improve my overall understanding of memory management in iOS.