memory management of app delegate on iOS
memory management of app delegate on iOS
- Subject: memory management of app delegate on iOS
- From: Matt Neuburg <email@hidden>
- Date: Mon, 19 Jul 2010 21:32:26 -0700
- Thread-topic: memory management of app delegate on iOS
"Objects in the nib file are created with a retain count of 1 and then
autoreleased... If you define outlets for nib-file objects, you should
always define a setter method (or declared property) for accessing that
outlet. Setter methods for outlets should retain their values."
And indeed, if I load a nib and don't retain its top-level objects (usually
thru outlets backed by a setter with a retain policy), they vanish in a puff
of smoke. So far, so good.
But what about the app delegate? In a typical iPhone app (e.g. the
template), the app delegate is instantiated through the MainWindow nib
loading. It is a top-level nib object. So it should be autoreleased.
Yet the UIApplication object does NOT retain its delegate. So why doesn't
the app delegate vanish in a puff of smoke? Is the MainWindow nib subject to
different memory management rules?
Thx -
m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden