Service Management how to register handle_checkbox_toggle?

Hi, I noticed in this page, there is no explanation about who/when/how the method handle_checkbox_toggle is called.

Page: https://developer.apple.com/documentation/servicemanagement/updating-helper-executables-from-earlier-versions-of-macos?language=objc

Ultimately, how should the app come to know when a app service is allowed or disallowed in System Settings > Login Items ?

Answered by DTS Engineer in 801636022

I think you’ve misunderstood the nature of that method. In the page you referenced, handle_checkbox_toggle(_:) shows how your app would respond to the user clicking a checkbox within your app to enable the login item. It’s not meant to show anything to do with the user clicking things in System Settings.

Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Accepted Answer

I think you’ve misunderstood the nature of that method. In the page you referenced, handle_checkbox_toggle(_:) shows how your app would respond to the user clicking a checkbox within your app to enable the login item. It’s not meant to show anything to do with the user clicking things in System Settings.

Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I also made the same mistake, thinking there was a way to be notified when settings were changed. Thing is, I've seen other apps do this. As soon as I enable a startup item, for instance, the app reacts and closes a priming window, or allows full functionality, etc.

The original question of "how should the app come to know when a app service is allowed or disallowed in System Settings > Login Items ?" is still unanswered here.