On Mar 16, 2009, at 10:21 PM, Steve Cronin wrote:
I use an object in my application called 'appDelegate'; it's a
subclass of NSObject.
I instantiate this object in the main Nib file
This object has IBActions for the main menu and since it is -app
delegate it is a kind on central dispatcher.
My question is this:
The +initialize is run twice when the app loads:
2009-03-16 20:21:42.690 XYZ[6676:813] *[AppDelegate initialize]
2009-03-16 20:21:42.781 XYZ[6676:813] *[NSKVONotifying_AppDelegate
initialize]
Once for the object itself and then again as the instance in the
Nib. That's how I read this. Is that wrong?
The specific reason that you got +initialize twice has to do with an
implementation detail of automatic KVO.
There are also other reasons that you could get +initialize twice.
(For example, a subclass of yours doesn't implement initialize.)
This is discussed in the NSObject documentation, and the pattern to
use to avoid "double" initialization is given.
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/nsobject_Class/Reference/Reference.html#/
/apple_ref/occ/clm/NSObject/initialize
Jim
_______________________________________________
Cocoa-dev mailing list ([email protected])
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]