Configurion a Cocoa app as a user agent
Greetings, I have a Login Item that I'd like to replace with a ~/Library/LaunchAgent. It's a LSUIElement=YES Cocoa application. What should the executable path be? If I set it to the bundle folder, is launchd smart enough to figure out that its an application? Or do I need to set it to .../MyApp.app/Contents/MacOS/MyApp? I ask because I've been warned by the Cocoa engineers to avoid starting applications that way. -- James Bucanek
At 9:38 -0700 9/12/07, James Bucanek wrote:
What should the executable path be? If I set it to the bundle folder, is launchd smart enough to figure out that its an application? Or do I need to set it to .../MyApp.app/Contents/MacOS/MyApp?
It has to point to the executable on disk; the bundle will not work.
I ask because I've been warned by the Cocoa engineers to avoid starting applications that way.
Really? Any explanation as to why? S+E -- Quinn "The Eskimo!" <http://www.apple.com/developer/> Apple Developer Relations, Developer Technical Support, Core OS/Hardware
Quinn <mailto:eskimo1@apple.com> wrote (Monday, December 10, 2007 2:18 AM -0000):
At 9:38 -0700 9/12/07, James Bucanek wrote:
What should the executable path be? If I set it to the bundle folder, is launchd smart enough to figure out that its an application? Or do I need to set it to .../MyApp.app/Contents/MacOS/MyApp?
It has to point to the executable on disk; the bundle will not work.
That's kind of what I thought.
I ask because I've been warned by the Cocoa engineers to avoid starting applications that way.
Really? Any explanation as to why?
This was back in 10.3, but it went something along the lines of "the bundle structure of applications might change in the future; the recommended method is to use Launch Services ..." -- James Bucanek
At 9:02 -0700 10/12/07, James Bucanek wrote:
This was back in 10.3, but it went something along the lines of "the bundle structure of applications might change in the future; the recommended method is to use Launch Services ..."
In general, that's good advice. In this particular case, it's reasonable to hard-code the bundle structure. After all, you control the agent. If, in some future world, the agent's bundle changes layout, you could change the property list to match. S+E -- Quinn "The Eskimo!" <http://www.apple.com/developer/> Apple Developer Relations, Developer Technical Support, Core OS/Hardware
participants (2)
-
James Bucanek
-
Quinn