I broke it into a very small project. Using the following code in the application deletion:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { TestingWindowController * testingWindowController = [[TestingWindowController alloc] initWithWindowNibName: @"TestingWindowController"];
And the next action is tied to a button on windows windows. (Note that the nib window is also set so that it is not visible at startup).
- (IBAction) onClose: (id) sender { [[NSApplication sharedApplication] endSheet: self.window returnCode: NSOKButton]; [self.window orderOut: nil]; }
What happens when I run onClose
, all windows disappear and I leave only the error dialog (the main window has disappeared).
Is there something wrong with my code? Why is my main window leaving?
NOTE. I know that I am not passing an error to the presentError method. I intentionally left this zero since I only had a short time to write sample code. Passing the actual error leads to the same behavior.
A sample project is available here .
source share