Post

Replies

Boosts

Views

Activity

Reply to NWBrowser not working for services named _ssh._tcp
Thank you for your reply. the failure I am seeing is a bit deeper in the process, not with the NWBrowser, but with the NWConnection I am ultimately using to resolve the ipaddress. Below, you will see my extra code that I added to the sample you provided above. I use the changes to create a NWConnection Is there a simpler way to get the ipaddress?    self.browser.browseResultsChangedHandler = { services, changes in             self.services = services.map { result in                 guard case .service(name: let name, type: _, domain: _, interface: let interface) = result.endpoint else { fatalError() }                 return Service(name: name, endpoint: result.endpoint, interface: interface, connection: nil)             }             print("SERVICES \(self.services)")             for change in changes {                 if case .added(let added) = change {                     switch added.endpoint {                     case .service(name: let name, type: let type, domain: let domain, interface: let interface):                         self.netConnection = NWConnection(to: .service(name: name, type: type, domain: domain, interface: interface), using: .tcp)                         print("netConnection stateUpdateHandler start")                         self.netConnection?.stateUpdateHandler = { (newState) in                             //with _ssh._tcp. this new state below never gets past `preparing`. With the other type, it goes to `ready` then I get the host                             print("netConnection newState \(newState)")                             switch (newState) {                             case .ready:                                 guard let currentPath = self.netConnection?.currentPath else { return }                                 if let endpoint = currentPath.remoteEndpoint {                                     switch endpoint {                                     case .hostPort(host: let host, port: _):                                         switch host {                                         case .ipv4(_):                                             //this is where I get the ipaddress ...                                             print("host ipv4: \(host.debugDescription)")                                         case .ipv6(_):                                             //this is where I get the ipaddress ...                                             print("host ipv6: \(host.debugDescription)")                                         default:                                             print("host: not found")                                             break                                         }                                     default:                                         break                                     }                                 }                             default:                                 break                             }                         }                     default:                         break                     }                 }             }             self.netConnection?.start(queue: .main)
Feb ’23
Reply to Xcode 15, how to uncheck "Connect via network" for physical device?
This is a HUGE issue for me! I am working on an IoT app that uses NEHotspotConfiguration to switch to the wifi network of a device to stream video. Once I connect to the IoT device, the connection to Xcode is lost. This is so hard to develop now, and since I am running Sonoma, I cannot revert to an older version of Xcode. And tuning off Wifi is not an option since that is required for the app to connect to the device.
Feb ’24