Using the application: willFinishLaunchingWithOptions instead of the application: didFinishLaunchingWithOptions:

I see that Apple in the default template uses application:didFinishLaunchingWithOptions : to set the window in the appDelegate class. My question is why do not use application:willFinishLaunchingWithOptions . Is there something that can only be done in application:didFinishLaunchingWithOptions .

Is it possible to use application:willFinishLaunchingWithOptions to initialize rootViewController.

I am still new to iOS, I understand that this might be a dumb question, but any help would be appreciated.

+6
source share
1 answer

Applications: willFinishLaunchingWithOptions

Informs the delegate that the start-up process has begun, but the recovery has not yet occurred.

Vs

Applications: didFinishLaunchingWithOptions

Tells the delegate that the launch process is almost complete and the application is almost ready to start.

Thus, the difference is clearly visible. See UIApplicationDelegate for more details.

So, the application: willFinishLaunchingWithOptions is just the previous application event: didFinishLaunchingWithOptions

So, after the event application: willFinishLaunchingWithOptions, the following event application will be launched: doneFinishLaunchingWithOptions.

So it definitely depends on your needs, but usually both are almost similar, and most of the time you may not need to use both of them.

So, in the normal case, you can use the application: didFinishLaunchingWithOptions as its last event in a similar category.

+4
source

Source: https://habr.com/ru/post/978595/


All Articles