• 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: Can't use +initialize, now what?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't use +initialize, now what?


  • Subject: Re: Can't use +initialize, now what?
  • From: Jens Alfke <email@hidden>
  • Date: Wed, 29 Mar 2017 13:17:50 -0700

> On Mar 29, 2017, at 10:52 AM, Quincey Morris <email@hidden> wrote:
>
> If willFinishLaunching is not early enough, then you can put code in your “main” function, but I don’t know how feasible that is in Swift.

Another trick to run stuff earlier at launch is to add an -awakeFromNib method to your app delegate, or any other object in your main nib. This can be dangerous, though, because you can’t count on any other object in the nib already being awoken, since the -awakeFromNib methods are called in random order. (I once had a very hard to debug intermittent crash due to an ordering dependency between two -awakeFromNib methods.)

—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


  • Follow-Ups:
    • Re: Can't use +initialize, now what?
      • From: Alastair Houghton <email@hidden>
References: 
 >Can't use +initialize, now what? (From: Daryle Walker <email@hidden>)
 >Re: Can't use +initialize, now what? (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: How to make a NSText​Find​Bar​Container client.
  • Next by Date: Re: Can't use +initialize, now what?
  • Previous by thread: Re: Can't use +initialize, now what?
  • Next by thread: Re: Can't use +initialize, now what?
  • Index(es):
    • Date
    • Thread