Communicating between System Extension (specifically, camera extension) and Container App

i am trying to send data from the container app to its system extension (specifically, a camera extension. i am not entirely sure how to go about this. i read that i could utilize XPC, and i have tried this but for some reason, the system extension returns nothing when trying to connect to the XPC Service. below is an example code snipper

let connectionToService = NSXPCConnection(serviceName: "example.VirtualCameraXPC")
    connectionToService.remoteObjectInterface = NSXPCInterface(with:VirtualCameraXPCProtocol.self)
    connectionToService.resume()
//checking processes available shows that the XPC Server process is never activated also.
if let proxy = connectionToService.remoteObjectProxy as? VirtualCameraXPCProtocol {
      proxy.getNewString() { aString in
      //this is never logged. 
        NSLog("Second result string was: \(aString)")
      }
    }

when i run the above code from the container app, it works properly but from the system extension, i run into the problems commented above in the code block.

i would appreciate any help that will help me successfully send data from my container app to my camera extension.

i read that i could utilize XPC

That’s not the approach we recommend. Rather, see my advice on this thread.

Share and Enjoy

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

Communicating between System Extension (specifically, camera extension) and Container App
 
 
Q