Looking at the sample project in: https://developer.apple.com/documentation/servicemanagement/updating_your_app_package_installer_to_use_the_new_service_management_api
It appears that the SMAppServiceSampleCode command line tool must be executed in a user context to successfully register the agent.
Consequently, the pkg that is created in the sample project would not register the agent if it is installed as root (or when installed from an MDM).
This could be worked out by using launchctl asuser to run the command line tool as the logged-in user user in the postinstall, but if nobody is logged in the pkg installation would actually fail.
If the command line tool is meant to be transparent to the user and not necessarily used by the user, are there any workarounds for this or something that I am missing?
I was under the impression that this might go away at some point
While I can’t predict The Future™, I can say that:
-
We’ve made no official statements that support your theory.
-
A lot of folks — both developers shipping products and advanced end users — rely on
launchdproperty lists, so taking them away would be a serious compatibility challenge.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"