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?
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.
1. awakeFromNib
2. applicationWillFinishLaunching
3. applicationDidFinishLaunching
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.