Reputation: 5044
Assume a default Xcode Cocoa app template where the App Delegate is in the main XIB file.
Of course, applicationWillFinishLaunching:
is called before applicationDidFinishLaunching:
.
Why is awakeFromNib
being called before applicationWillFinishLaunching:
?
The docs for applicationWillFinishLaunching:
say this:
Sent by the default notification center immediately before the application object is initialized.
Why does this not contradict awakeFromNib
being called before applicationWillFinishLaunching:
?
Can I rely on this order?
Upvotes: 3
Views: 2202
Reputation: 3573
1. awakeFromNib
2. applicationWillFinishLaunching
3. applicationDidFinishLaunching
Upvotes: 1
Reputation: 53502
The order is awakeFromNib, applicationWillFinishLaunching and applicationDidFinishLaunching, which makes sense, given that you first need to load the UI before you can actually run the application. The notification is not applicationDidStartLaunching which one could see as something that has to go before awakeFromNib.
Upvotes: 5
Reputation: 12183
According to this answer, awakeFromNib
is called when the controller is being extracted from the nib archive. I suppose that is happening after the application has finished launching.
Upvotes: 0