Re: When does AppDelegate:applicationDidFinishLaunching get called?


Dave
 

Hi,

This is a Mac project but I will be doing an IOS version too.

I’ve tried applicationWillFinishLaunching and applicationDidFinishLaunching, but the View Controller gets control before either are called.

This is a Single Window based App.

The difference is that before I was manually instantiating the View Controller in applicationDidFinishLaunching (after initialising the App), now its being instantiated automatically by the OS.

Seems a bit weird to be honest, the fact that the Window has displayed means that the App

What dictates whether an App has launched? I’m guessing that the automatic loading is considered part of the Launch process, which would make sense given the naming of the methods.

Maybe there should be a “applicationDidBeginLauching”.

If there really isn’t a safe place to perform this type of initialisation then I guess I could always go back to manually instantiating the Window/View Controller…..

All the Best
Dave


Is this a document-based app or a single-window type app?

In my single-window apps, AppDelegate:applicationDidFinishLaunching is called first, and instantiates and displays the main window, so the window’s init and awakeFromNib methods are called before AppDelegate:applicationDidFinishLaunching ends.

In my document-based app, the DocumentWIndowController:windowDidLoad (and presumably viewDidAppear) are called before the AppDelegate:applicationDidFinishLaunching.

Jim Crate

Join cocoa@apple-dev.groups.io to automatically receive all group messages.