Post

Replies

Boosts

Views

Activity

Reply to Keep app "alive" when going from Login to user context.
Hello Eskimo! So I was able to run my program as a daemon and it is keeping the connection with my client but now I'm getting some strange behavior with my screen capturing. When going into the LoginWindow the frame I get is just the background image of Ventura OS but I'm able to remote control the mouse and keyboard as expected so it kind of makes me feel like it has something to do with my AVCapture session and it running in a global context? Still trying to find out more on this but I figured I would update my status.
Topic: App & System Services SubTopic: Core OS Tags:
Nov ’22
Reply to Keep app "alive" when going from Login to user context.
That sounds like a TCC issue. What does CGPreflightScreenCaptureAccess return? that returns true and everything works as expected when capturing the screen until I log out. That's when the my frames stay in the background image of the OS and I'm unable to see the password textField but everything else continues to work (mouse and keyboard remote control). I'm now trying to connect to my Daemon but I'm unable to do it. Here is how I'm testing. Here is my daemon plist. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>KeepAlive</key> <true/> <key>Label</key> <string>com.myCompany.myCompanyServer</string> <key>MachServices</key> <dict> <key>com.myCompany.myCompanyServer.xpc</key> <true/> </dict> <key>RunAtLoad</key> <true/> <key>ProgramArguments</key> <array> <string>path to my exec </string> <string>service</string> </array> <key>QueueDirectories</key> <array/> <key>Item 0</key> <string>path to queue directory</string> </dict> </plist> At this point I'm certain my daemon is up a running. Here is what it'll be my agent running as root. For some reason my interruptionHandler always gets called right away. final class DaemonConnection { private var machServiceName = "com.myCompany.myCompanyServer.xpc" private var daemonConnection: NSXPCConnection init() { daemonConnection = NSXPCConnection(machServiceName: machServiceName, options: [.privileged]) daemonConnection.interruptionHandler = interruptionHandler daemonConnection.invalidationHandler = invalidationHandler daemonConnection.resume() } private func interruptionHandler() { print("daemon connection was interrrupted") } private func invalidationHandler() { print("daemon conenction was invalidated") } } and here is my daemon code: private var machServiceName = "com.myCompany.myCompanyServer.xpc." xpcListener = NSXPCListener(machServiceName: machServiceName) xpcListener.delegate = self xpcListener.resume() then my listener delegate func listener(_ listener: NSXPCListener, shouldAcceptNewConnection newConnection: NSXPCConnection) -> Bool { Logger.shared.logDebug(logtag, " ******* received new xpc connection request from \(String(describing: newConnection.serviceName)) *****") return true } when I run launchctl print system/myDaemon.plist I see environment = { XPC_SERVICE_NAME => com.myCompany.myCompanyServer } and I would expect that to be com.myCompany.myCompanyServer.xpc? so it seems I'm missing something? Let me know what you think
Topic: App & System Services SubTopic: Core OS Tags:
Nov ’22
Reply to Keep app "alive" when going from Login to user context.
Hello! I crated the support incident and today as I was trying again and I realized my app was sandbox. After dealing with that this is what I have: let service = daemonConnection.remoteObjectProxyWithErrorHandler { err in print("Received error: \(err.localizedDescription)") } as? MyServiceProtocol which prints: Received error: Couldn’t communicate with a helper application. or Received error: Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.serviceName" UserInfo={NSDebugDescription=connection to service named com.serviceName }
Topic: App & System Services SubTopic: Core OS Tags:
Nov ’22
Reply to Keep app "alive" when going from Login to user context.
And one more update, my NSXPC connection is now working. But I'm sill facing the same issue with the screen capturing. Everything works great until I log out, I get most of the image but I cannot see the textview to enter my password but everything else works (remote keyboard, mouse, etc) and the screen frame I get remains the same from then on (the cool red background image for Ventura)
Topic: App & System Services SubTopic: Core OS Tags:
Nov ’22
Reply to Issues with LaunchAgent and LaunchDaemon
Thank you for your response and apologies for taking so long to answer. The only solution here is to structure your product so that: The core functionality lives in the daemon, which the user can’t kill [1]. The user doesn’t gain anything by killing your agent. BlockQuote So essentially, my LaunchDaemon (in charge of the networking) and my LaunchAgent (in charge or capture SytemEvents) will always be running.
Topic: App & System Services SubTopic: Core OS Tags:
Aug ’24