Hi.
Our NWListener runs fine and accepts connections successfully when it's run in a standalone app, however, the same code fails when moved into the System Extension code.
Specifically, we get the error: The operation couldn’t be completed. (Network.NWError error 0.)
...
let listener = try NWListener(using: params!)
listener.service = NWListener.Service(name: "service",
type: "_service._tcp")
listener.stateUpdateHandler = { newState in
switch newState {
case .ready:
if let port = listener.port {
self.receiveIncomingDataOnConnection()
}
case .failed(let error):
listener.cancel()
print("Listener - failed with %{public}@, restarting", error.localizedDescription)
// Getting the error ^
default:
break
}
}
...
We have checked that the App Sandbox permissions for inbound and outbound connections are set in the entitlements file.
At this point, we are stumped at what's limiting our listener when it's running in the extension.
Thanks!