I tried both ways In a sandboxed app and daemon and once without sandboxing. In both cases I did not receive request for the authorisation on calling SMAppService.register(), I am getting error -
"Unable to register Error Domain=SMAppServiceErrorDomain Code=1 "Operation not permitted" UserInfo={NSLocalizedFailureReason=Operation not permitted}"
meanwhile I tried calling -
SMAppService.openSystemSettingsLoginItems()
It opens system settings where I manually added my app in
Allow in the background
post that I was able to Launch daemon successfully.
But for user it might be little tedious and confusing as Login items and Extensions setting page consist Login items, Allow in the background and Extentions, then user need to add app manually, quit application and launch again.
Why SMAppService.register() is not popping the request for user authorisation I sandboxed both App and daemon.
Topic:
App & System Services
SubTopic:
Core OS
Tags: