We have a simple sandboxed app with important checkbox, and toggling it enables a system-wide setting. In order for this setting to be applied at login, we use a Service Management login item installed via SMLoginItemSetEnabled, located in in the main app bundle’s Contents/Library/LoginItems folder.
A couple of questions:
-
General — does the helper tool need to launch the main app, or can it apply the setting itself? All we have to do is apply a setting at login without showing UI, then terminate the app.
-
Technical — does the helper tool need to be a full application bundle, or can it be just a simple sandboxed command line tool, since it has no UI?
Any suggestions are welcome on how to elegantly solve this and still fly in Mac App Store.
I just emailed you the details.
Thanks.
It sounds like your primary concern is the ‘weight’ of a Service Management login item. That is, you think that such a login item would be more expensive than, say, running a shell script via a launchd agent. That’s not the case. Running a process is relatively expensive, and the difference in cost between two different processes largely depends on what those processes do. Indeed, if you strip down your Service Management login item to just the code that calls the API to set the state you need, it will be less expensive than a launchd agent that runs a shell script that runs a built-in tool because:
-
The latter approach needs two processes.
-
The built-in tool is a general-purpose thing, which means it’ll be more expensive than your special-purpose code.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"