Hello,
I am currently struggling with a strange behaviour in an attempt of creating a NWListener:
Given I use some simple code like:
var listener: NWListener = try NWListener(using: .tcp, on: 12345)
listener.newConnectionHandler = connectionHandler
listener.stateUpdateHandler = stateUpdateHandler
listener.start(queue: .main)
dispatchMain()
(with declared connectionHandler as well as stateUpdateHandler), I successfully can open a listener when running the code in a "Command Line Tool" target. Yet, when I attempt to run it in a "macOS U Testing Bundle", I receive a " nw_listener_socket_inbox_create_socket bind failed [1: Operation not permitted]" error.
The sandbox is not enabled on the project; adding com.apple.security.network.server to the entitlements did not help though.
Does anybody know if this has to do with restrictions of the UI testing bundle / XCUITest or -better- how to solve this?
Best,
Chris