• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: app delegate +initialize
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: app delegate +initialize


  • Subject: Re: app delegate +initialize
  • From: Graham Cox <email@hidden>
  • Date: Thu, 8 Oct 2009 15:38:53 +1100


On 08/10/2009, at 2:39 PM, John Baldwin wrote:

The AppController has a +initialize method which initializes my user defaults.

It's better to initialise your defaults in your app delegate's - applicationWillFinishLaunching: method, since it is called at a completely invariant time during the launch process.



So I'm expecting the AppController instance to be loaded and the +initialize method to be called before my window controller is loaded and its outlets start getting referenced.


You can't expect this. Objects loaded from a nib are not loaded in any particular order that you can rely on.

Also, in general, relying on certain user defaults being present can be fragile, for exactly the reasons you are finding - unknown initialisation order. Better to design your controllers to either not need user defaults to initialise itself, or else initialise your user defaults at a specific known point during launch that you can rely on.

--Graham

_______________________________________________

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


  • Follow-Ups:
    • Re: app delegate +initialize
      • From: Fritz Anderson <email@hidden>
References: 
 >Re: app delegate +initialize (From: John Baldwin <email@hidden>)
 >Re: app delegate +initialize (From: John Baldwin <email@hidden>)
 >Re: app delegate +initialize (From: Jens Alfke <email@hidden>)
 >Re: app delegate +initialize (From: John Baldwin <email@hidden>)

  • Prev by Date: Re: [iPhone] WebView and problem with rotation
  • Next by Date: unused window initializer in document-based cocoa app
  • Previous by thread: Re: app delegate +initialize
  • Next by thread: Re: app delegate +initialize
  • Index(es):
    • Date
    • Thread