• 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: "Henry McGilton (Boulevardier)" <email@hidden>
  • Date: Wed, 7 Oct 2009 21:31:14 -0700


On Oct 7, 2009, at 8:39 PM, John Baldwin wrote:

Perhaps that's what's tripping me up: bogus expectations. Here's what I have set up.

In the xib file, the File's Owner delegate is set to an AppController instance (an object in the xib).

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

Inside the xib is a window which is set to visible at launch. The error happens in the window controller for this window, which is expecting the user defaults to be initialized by the AppController instance.

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.

John

The order of un-archiving from a NIB is un-defined . . .

    Cheers,
        . . . . . . . .    Henry




On Wednesday Oct 7 10:48 AM, at 10:48 AM, Jens Alfke wrote:


On Oct 6, 2009, at 11:30 PM, John Baldwin wrote:

When the application crashes on launch, there is no record of the +initialize method being called. When the application launches successfully, there is a record of the +initialize method being called.

I haven't been following the whole thread, but are you assuming that all classes are initialized immediately when the process launches (similar to C++ static initializers)? Because that isn't the way it works. A class isn't initialized until the first time it's used — by creating an instance, calling a class method, or looking up the class by name.


So it's entirely possible that something unrelated to this class is causing a crash before that class ever gets referenced. Are you able to get a backtrace or crash log?

—Jens


_______________________________________________

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


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: 64bit Method Swizzling
  • Next by Date: Re: [iPhone] WebView and problem with rotation
  • Previous by thread: Re: app delegate +initialize
  • Next by thread: Re: app delegate +initialize
  • Index(es):
    • Date
    • Thread