Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3795530
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T13:05:52+00:00 2026-05-19T13:05:52+00:00

My understanding of Runloops is basic so this may seem like a very trite

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T13:05:53+00:00Added an answer on May 19, 2026 at 1:05 pm

    Those tasks will execute in order on the main thread’s run loop. Since UI updates also occur on the main thread you will not allow your app to redraw the screen until after you return from -application:didFinishLaunchingWithOptions: so while [window makeKeyAndVisible]; will complete before [myTaskObject doSomeTaskHere]; you are still blocking the UI from updating until that doSomeTaskHere is complete.

    If doSomeTaskHere is an expensive operation you should schedule it for a future iteration of the run loop or better yet do that work on a different thread so that the UI can update and respond to touches.

    performSelectorOnMainThread:withObject:waitUntilDone:YES would not allow the main thread to update the UI as unless you passed NO as the last parameter. Telling the main thread to wait until the main thread finishes some other work isn’t very useful or any different than invoking that selector directly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.