I'm seeing crashes within NWPathMonitor.pathUpdateHandler and in various parts of NWPath (sometimes on dealloc of NWPath).
One thing I noticed is that we are using a global concurrent queue in the call to NWPathMonitor.start(queue:). Could this be the reason? The crash isn't easily reproducible, but I'll see if I can find a way to test this.
It would be nice to have an authoritative answer about this, though. The documentation makes no mention that the queue must be serial. And NWPath is a struct, so it seems unexpected to require a serial queue.
To be clear, I'm doing something like this:
let nwPathMonitor = NWPathMonitor()
nwPathMonitor.pathUpdateHandler = { [weak self] path in
guard let self else { return }
// do stuff with path
}
nwPathMonitor.start(queue: DispatchQueue.global(qos: .background))