The following code won't work:
- (void)windowDidLoad {
[super windowDidLoad];
self.window.isVisible = NO;
}
The only main window still shows on application startup (in a minimal newly created app).
One of my published apps in App Store relies on this behavior which had been working for many years since I started Xcode development.
Looking at the documentation it's not clear to me if it is safe to try to hide a window inside of the NSWindowController's windowDidLoad method. Also, isVisible is a defined as a read-only property:
@property (readonly, getter=isVisible) BOOL visible;
so if it ever was working that was probably a bug. To hide a window you need to call orderOut:. I did some testing here and it appears that calling orderOut: to hide a window inside of the NSWindowController's windowDidLoad method does not work. However, if you call orderOut: later on the main thread using performSelectorOnMainThread:withObject:waitUntilDone::
[self.window performSelectorOnMainThread:@selector(orderOut:)
withObject:self.window
waitUntilDone:NO];
The window will be hidden as expected.
It's not entirely clear to me if calling orderOut: inside of the NSWindowController's windowDidLoad method should work. windowDidLoad is called after the window has been loaded from the nib, but it's not clear from the documentation and header comments if you can modify any of the parameters at that time. If you're interested in finding out the definitive answer I suggest filing a bug report.
If you file a bug report, please include an Xcode project and some directions that can be used to reproduce the problem. And after that please post the Feedback number here. I'll check the status and provide an update (if there's anything to report) next time I do a sweep of forums posts where I've suggested bug reports.
Bug Reporting: How and Why? has tips on creating your bug report.