There is some app configuration code (e.g. ensuring that all logging is done to a specific file) that needs to run before any other app code is run. It needs to be the very first piece of my code that is run.
Now, it is not enough for me to put this in AppDelegate.applicationDidFinishLaunching() because certain other app code (object init()) runs before the app finishes launching. In other words, didFinishLaunching() is too late in the app lifecycle for my purposes.
So, basically, I'm trying to find a way to hook into the application life cycle stage that occurs before the app launches (and any other app code runs). I have looked at and tried implementing all NSApplicationDelegate lifecycle methods, with no luck. Ideally, there would be an NSApplicationDelegate method like applicationWillLaunch(), but there isn't one (there is applicationWillFinishLaunching, but that is too late).
I have achieved this, tentatively, by subclassing NSApplication and overriding its init() method. This works, but is there a better way ? Is there a method either in NSApplication or NSApplicationDelegate that I can implement/override that will execute before the app begins launching ?
Thanks !
Now, it is not enough for me to put this in AppDelegate.applicationDidFinishLaunching() because certain other app code (object init()) runs before the app finishes launching. In other words, didFinishLaunching() is too late in the app lifecycle for my purposes.
So, basically, I'm trying to find a way to hook into the application life cycle stage that occurs before the app launches (and any other app code runs). I have looked at and tried implementing all NSApplicationDelegate lifecycle methods, with no luck. Ideally, there would be an NSApplicationDelegate method like applicationWillLaunch(), but there isn't one (there is applicationWillFinishLaunching, but that is too late).
I have achieved this, tentatively, by subclassing NSApplication and overriding its init() method. This works, but is there a better way ? Is there a method either in NSApplication or NSApplicationDelegate that I can implement/override that will execute before the app begins launching ?
Thanks !