When I fire up my OS X app from Xcode, it appears as it should.
When I close the window, it disappears (as you would expect), and the app still appears active on the dock.
Great, that's how it should be. But when I click the dock to activate the window, it doesn't show up.
Any ideas?
Sometimes restore point might not work due to corrupted files and folders on your drive, and to fix the corrupted files, you might need to check your hard drive. This process can take a while, so be patient. You might have to restart your computer to complete the disk-checking process.
There isn't much information in the question, but let me presume that the app is a single-window app (i.e., not NSDocument
-based).
A typical situation in this scenario is that the user closes the window, and the appliction keeps running with the icon in the Dock as it is supposed to.
In that situation, the user would normally like the window to re-appear when the app is activated by clicking the icon in the Dock.
To obtain that, you can implement applicationShouldHandleReopen:hasVisibleWindows:
as follows:
- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)visibleWindows
{
if ( visibleWindows ) {
[self.window orderFront:self];
}
else {
[self.window makeKeyAndOrderFront:self];
}
return YES;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With