Start Cocoa app without showing the main window
-
25-10-2019 - |
Question
I have a simple Cocoa app with a single NSWindow where I can enter some credentials and after the submission the app starts an another process. In case the credentials were entered once and cached I would like to start the process by running the app without showing the app's main window. How can I achieve that?
The app has only one class that conforms to NSApplicationDelegate and one .xib file.
Solution
Is your window created from a xib file? There should be a "Visible at launch" checkbox in the properties for the window.
You'll need some other UI (such as a menu item) to start your work going — or you could put that in applicationDidFinishLaunching:
.
OTHER TIPS
In your MainMenu.xib file, select the window and uncheck "Visible at launch". I believe this is all you need to do.