• 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: How dangerous is +load?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How dangerous is +load?


  • Subject: Re: How dangerous is +load?
  • From: "John C. Randolph" <email@hidden>
  • Date: Wed, 30 Apr 2003 14:11:17 -0700

On Wednesday, April 30, 2003, at 11:34 AM, Georg Tuparev wrote:

Folks,

Here a method that works:

+(void)load
{
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(configureTestingUI:)
name: NSApplicationDidFinishLaunchingNotification
object: nil];
}

... but is dangerous because there is no guarantee that at the time the Notification Center is loaded. But I really do not want to create any dependancies between the class in question and NSApp or its delegate. I have done some digging, and it seams Foundation classes are always loaded before the classes from my framework, so in all examples the method above did not caused any trouble. But I would prefer to replace it. (For good or bad, +initialize is not called if no other method is sent to the class).

Any suggestions how can I achieve the same functionality in a more kosher way?

Why not just send -configureTestingUI from your app delegate's -applicationDidFinishLaunching: method?

-jcr

John C. Randolph <email@hidden> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.html
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >How dangerous is +load? (From: Georg Tuparev <email@hidden>)

  • Prev by Date: Re: How dangerous is +load?
  • Next by Date: Re: Appending multiple dictionaries to a plist
  • Previous by thread: Re: How dangerous is +load?
  • Next by thread: Re: How dangerous is +load?
  • Index(es):
    • Date
    • Thread