Post

Replies

Boosts

Views

Activity

Reply to NWPath thread safety
Update: When running the basic example with the following let nwPathMonitor = NWPathMonitor() nwPathMonitor.pathUpdateHandler = { path in if path.usesInterfaceType(.wifi) { // Correctly goes to Wi-Fi via Access Point or Phone enabled hotspot os_log("Path is Wi-Fi") } else if path.usesInterfaceType(.cellular) { os_log("Path is Cellular") } else if path.usesInterfaceType(.wiredEthernet) { os_log("Path is Wired Ethernet") } else if path.usesInterfaceType(.loopback) { os_log("Path is Loopback") } else if path.usesInterfaceType(.other) { os_log("Path is other") } } let queue = DispatchQueue(label: "Monitor") nwPathMonitor.start(queue: queue) application crash on real device (use iphone 11 with ios 17.4.1) btw on sim it works fine, only when I changes to .main as Matt Eaton suggested it work on device
May ’24