I have a remote control application working in user context but I'm trying to implement "remote login". During the LoginWindow I'm able to "launch" the app, establish connection and login but as son as I click log in the connection is lost until the app gets relaunched in the user context.
I'm reading about LaunchAgents, daemons and xpc services but it is all very confusing so I'm trying to get some pointers.
Right now I save my plist in /Library/LaunchAgents with the key LimitLoadSessionType set to LoginWindow "pointing" to my apps executable. This gets my app running during the LoginWindow and I can remote login.
Once I hit enter to login my app gets shutdown with no mercy until it gets launched in the user context by another LaunchAgent.
I know that there is a way to keep my app alive ( I say alive but I'm not sure that's how it actually works) while it goes from Login to user context. Does anyone know the work flow for a process like this? how does a LaunchAgent daemon connects to a xpc service?
Does this mean that in general my application should be done in two parts
I recommend three parts:
-
A
launchddaemon for managing the network and centralised command and control. -
A
launchdagent running in each GUI login session, providing window server access on behalf of the daemon. -
An app, that the user can run to configure the service.
Don’t try to merge the last two; that’s likely to end badly.
I was just reading about xpc service
You are confusing an XPC service with a named XPC endpoint. An XPC service is a bundled chunk of code that you can embed within your app. A named XPC endpoint is an XPC listener that you can look up by name and communicate with. An XPC service publishes a named XPC endpoint, but other code can as well. Specifically launchd daemons and agents can do this using the MachServices property in their launchd.plist.
An XPC service is unlikely to be helpful in this scenario.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"