Post not yet marked as solved
Click to stop watching this thread.
You have stopped watching this post. Click to start watching again.
contentPostList.repliesup-voted.tooltip
Replied In
Check if Local Network access is granted
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
}
}
}