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

  • SEARCH
  • Home
  • 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 9124163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:30:43+00:00 2026-06-17T06:30:43+00:00

So I have a program that after a try/catch block occurs I need a

  • 0

So I have a program that after a try/catch block occurs I need a modal window to appear so the user can make a specific choice then I would like the program to continue on. I have no Idea how to make this work and I keep getting these exceptions.

*** Assertion failure in -[NSApplication _commonBeginModalSessionForWindow:relativeToWindow:modalDelegate:didEndSelector:contextInfo:], /SourceCache/AppKit/AppKit-1187.34/AppKit.subproj/NSApplication.m:3920

Exception detected while handling key input.

Modal session requires modal window

I have configured my modal sheet to appear in 2 different ways the first way is Via a button press and the 2nd way is after my try catch block. When I make it appear Via a button press that is linked directly to Configure Game it works fine but when I do it through a try catch block in another method it throws all the exceptions above.

//Method that opens the modal sheet
- (IBAction)configureGame:(id)sender
{
    //Calls a webview for the user to go to a specific location   
    NSString *FGstarter = @"http://www.google.com";
    NSURL *FGplayerUrl = [NSURL URLWithString:FGstarter];        
    [webView setMainFrameURL:[FGplayerUrl absoluteString]];

    //Opens the Modal Sheet
    [NSApp beginSheet:configureSheet modalForWindow:mainWindow
        modalDelegate:self didEndSelector:NULL contextInfo:nil];

}

//Select Method to a Select button which also closes the Sheet
- (IBAction)select:(id)sender{
    //sets a NSString Instance Var to the Current URL of the webView
    currentPage = [webView stringByEvaluatingJavaScriptFromString:@"window.location.href"]);

    //Closes the sheet
    [NSApp endSheet:configureSheet];     
}


-(NSMutableArray *)loadPlayer:(NSString *)name{
@try {
   // Code here might cause exception that gets caught in the catch
}
@catch (NSException *exception) {
    //When I call this function I get all the exceptions listed in the top of the post
    [self configureGame:nil];
    //Ideally here what would happen here is the modal sheet would pop up the user would hit the select button that calls the select method then the program continues running.  
}
   NSString *page = currentPage;
   //...Continue Using this method
}
  • 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-06-17T06:30:44+00:00Added an answer on June 17, 2026 at 6:30 am

    Please don’t do this. From the Apple Docs…

    Important In many environments, use of exceptions is fairly commonplace. For example, you might throw an exception to signal that a routine could not execute normally—such as when a file is missing or data could not be parsed correctly. Exceptions are resource-intensive in Objective-C. You should not use exceptions for general flow-control, or simply to signify errors. Instead you should use the return value of a method or function to indicate that an error has occurred, and provide information about the problem in an error object. For more information, see Error Handling Programming Guide.

    See also the top answer to this question:
    When porting Java code to ObjC, how best to represent checked exceptions?

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

Sidebar

Related Questions

I have a program that gets input from the user via swing through a
So i'm trying to make a program that can find how many pixels of
I have today a program that I can post through to my site, but
I have a foreach loop that starts a process within a try/catch. In the
I have program that requires Python 3, but I develop Django and it uses
I have program that has a variable that should never change. However, somehow, it
I have program that runs fast enough. I want to see the number of
I have a program that gets a JSON from the server using getJSON and
I have a program that saves an image in a local directory and then
I have a program that reads from a file that grabs 4 bytes from

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.