On Jan 14, 2010, at 11:57, David Blanton wrote:

> When my document based app starts up the awakeFromNib method in my NSDocument 
> subclass is called.
> 
> When I choose Open a new NSDocument is instanced but this does not call 
> awakeFromNib.
> 
> Am I missing a setting?
> 
> I need awakeFromNib to be called for any instance on my NSDocument sublass.

'[NSDocument awakeFromNib]' is invoked because (or when, if you prefer) the 
document is File's Owner for the associated nib file. Your symptoms would 
suggest that it's being set as File's Owner when a File -> New... is done 
(since that's what you get for free when the application starts up) but not 
when a File -> Open... is done. Is it possible there are two nib files being 
used in these two situations?

If you've set the document's window controller as File's Owner, then *it* will 
get the 'awakeFromNib' instead of the document.

Also, as usual when an application mysteriously fails to do something, it's 
vital to check the log for exception error messages -- something I typically 
forget to do.

Does any of that suggest anything helpful?


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to