What method should be called to deactivate an app right after it's launch in applicationDidFinishLaunching:
delegate method has been called? Or maybe there is a better place to do that? The documentation for deactivate
method for NSApplication
says that I shouldn't call this method directly since AppKit knows better how to deactivate stuff.
Asked
Active
Viewed 1,498 times
1
2 Answers
2
Maybe using -[NSApplication hide:]
would work, or perhaps activate another app using -[NSRunningApplication activateWithOptions:]
(10.6 only, tho). However, I don't foresee many problems with using deactivate:
.

Dave DeLong
- 242,470
- 58
- 448
- 498
-
I think i'll try with NSRunningApplication approach. Thanks a heap! – Eimantas Nov 16 '09 at 10:39
1
It's not clear what you're trying to achieve.
You can use -hide:
to deactivate your app. I also wouldn't hesitate using -deactivate
if it actually does what you need. It's just that normal applications do not explicitly deactivate themselves; I think that's what the documentation is saying.
However, if you set LSUIElement
in Info.plist your application should not become active when launched; it also won't have a menu bar or dock icon.

Darren
- 25,520
- 5
- 61
- 71
-
App does become active after launch, since I added global event monitor and i get beeps each time i press the global key registered in global event monitor. Global event monitors don't route events to the app while it's being active. Right? – Eimantas Nov 16 '09 at 10:38