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 7525925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:41:25+00:00 2026-05-30T03:41:25+00:00

I have a Cocoa app with a custom, multi-step account setup that I implemented

  • 0

I have a Cocoa app with a custom, multi-step account setup that I implemented as a custom modal dialog with a set of views.

The problem is that the background operations (fetching a URL) seem to get stuck. I assume that this is because the application is in a modal mode.

Here the code to start the modal dialog:

[NSApp beginSheet:accountSetupController.window modalForWindow:self.window 
            modalDelegate:nil didEndSelector:NULL contextInfo:NULL];

[accountSetupController beginAccountSetup]; // this later launches the background operation
[NSApp runModalForWindow:accountSetupController.window];

NSApp endSheet:accountSetupController.window];

First of all, is my assumption correct? Is there a way to have the background operation proceed even if the application is running modal?

The actual background operation is not under my control. It is an external API that takes a completion block.

  • 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-30T03:41:27+00:00Added an answer on May 30, 2026 at 3:41 am

    Take a look at the “discussion” section of your call to [NSApplication beginSheet: modalForWindow: ...]:

    Discussion

    This method runs the modal event loop for the specified sheet
    synchronously. It displays the sheet, makes it key, starts the run
    loop, and processes events for it. While the application is in the run
    loop, it does not respond to any other events (including mouse,
    keyboard, or window-close events) unless they are associated with the
    sheet. It also does not perform any tasks (such as firing timers) that
    are not associated with the modal run loop. In other words, this
    method consumes only enough CPU time to process events and dispatch
    them to the action methods associated with the modal window.

    To me, this means that background threads and tasks aren’t running while this modal session is going. I’ve run into this problem before with my own modal dialogs trying to access web servers (for registration purposes, if I remember correctly).

    The best solution is to not use modal dialogs if you need to talk to a server asynchronously. If you must use modal dialogs, try to do your communication between modal sheets (i.e. when the user hits “submit”, end the sheet and do the server chatting, then bring up the next sheet for the next step).

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

Sidebar

Related Questions

I have a custom icon file (MyApp.icns) set up for my Cocoa App. How
I have a multi-threaded Cocoa app that processes images. The program has a progress
I have a Cocoa app that uses a WebView to display an HTML interface.
I have a Cocoa app I'm writing that has an ImageView with a TextView
I have a graphics editing cocoa app on Mac OSX that produces 32 by
I have a very simple Mac Cocoa app that just has a Web View
I have some processing in my Cocoa app that sometimes ends up calling through
I recently started programming my first Cocoa app. I have ran into a problem
I have a Cocoa app that embeds a WebView. I'd like to intercept a
I have a normal cocoa app with the UI that communicates with a daemon.

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.