subscribe for fast user switch notifications

Hi, i have a daemon service written in Objective-C and C++. i need to detect user change events and reboot my service. I'm using SCDynamicStoreKeyCreateConsoleUser and get notifications for user switch events but not for fast user switch events. is there a way to reliably subscribe to all kinds of user switch events including VNC connection?

Replies

i need to detect user change events and reboot my service.

Say what?

That suggests that your daemon only works with a single logged in GUI user, which is a problem because there can be multiple logged in GUI users simultaneously active.

The standard way to handle this is to install a launchd daemon and launchd agent. The agent is instantiated once per GUI login session. It can then inform your daemon about state transitions, and also perform GUI work at the request of the daemon.

Share and Enjoy

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