Reposting code block:
let port = NWEndpoint.Port(rawValue: UInt16(80))!
self.connection = NWConnection(host: host, port: port, using: .tcp)
self.connection?.stateUpdateHandler = { latestState in
if #available(iOS 14.2, *) {
if self.connection?.currentPath == nil {
return
} else if self.connection?.currentPath?.unsatisfiedReason == .localNetworkDenied {
// permission is not granted
} else {
// permission is granted
}
}
}
Topic:
App & System Services
SubTopic:
Networking
Tags: