My understanding of Runloops is basic so this may seem like a very trite question.
I have the following in my application:didFinishLaunchingWithOptions
(or applicationDidFinishLaunching
):
{
// 1. typical app setup work: create various views, create a tab bar, add
// navigation controller and views to the tab bar
// 2. perform some other app initialization tasks
// 3. Add main view to the window
[window addSubview:tabbarController.view];
// 4. Make window visible
[window makeKeyAndVisible];
// 5. Perform one final behind the scene task
[myTaskObject doSomeTaskHere];
}
Do each of these methods get executed in order listed or is there any chance that step #5 can happen before the app's main runloop completes the work of putting up the main window with '[window makeKeyAndVisible]'
Does the doSomeTaskHere
need to get wrapped up into a performSelectorOnMainThread:withObject:waitUntilDone:YES
to ensure that the runloop completes the displaying of the window and thus loading whatever view that is the topmost view before 'doSomeTaskHere
' is invoked?