I’m trying to trace down connectivity issue with a Watch App; Preflighting the app has Bluetooth and WIFI Access.
I have code that works well on iOS, but the NWPathMonitor always return that there is not Network connection because “unsatisfied (Path was denied by NECP policy), interface: ipsec0, ipv4”
What is NECP? What is NECP Policy? Why does this work in the simulator but not on the real device?
If this is not intended for the watch, why can I build this with no errors or warnings from the compiler?
Thanks,
Thomas
Source:
import Network
// Network Stuff
let monitor = NWPathMonitor()
// let monitor = NWPathMonitor(requiredInterfaceType: .cellular)
// let monitor = NWPathMonitor(requiredInterfaceType: .wifi)
let queue = DispatchQueue(label: "InternetConnectionMonitor")
var queueStarted:Bool = false
monitor.pathUpdateHandler = { pathUpdateHandler in
print( "\npathUpdateHandler = \(pathUpdateHandler)" )
if pathUpdateHandler.status == .satisfied {
DispatchQueue.main.async {
print("Internet connection is on.")
}
} else {
DispatchQueue.main.async {
print("There's no internet connection.")
}
}
}
if !queueStarted {
monitor.start(queue: queue)
queueStarted = true
}
Output:
pathUpdateHandler = unsatisfied (Path was denied by NECP policy), interface: ipsec0, ipv4)
There's no internet connection.
I have code that works well on iOS, but the NWPathMonitor always return that there is not Network connection because “unsatisfied (Path was denied by NECP policy), interface: ipsec0, ipv4”
What is NECP? What is NECP Policy? Why does this work in the simulator but not on the real device?
If this is not intended for the watch, why can I build this with no errors or warnings from the compiler?
Thanks,
Thomas
Source:
import Network
// Network Stuff
let monitor = NWPathMonitor()
// let monitor = NWPathMonitor(requiredInterfaceType: .cellular)
// let monitor = NWPathMonitor(requiredInterfaceType: .wifi)
let queue = DispatchQueue(label: "InternetConnectionMonitor")
var queueStarted:Bool = false
monitor.pathUpdateHandler = { pathUpdateHandler in
print( "\npathUpdateHandler = \(pathUpdateHandler)" )
if pathUpdateHandler.status == .satisfied {
DispatchQueue.main.async {
print("Internet connection is on.")
}
} else {
DispatchQueue.main.async {
print("There's no internet connection.")
}
}
}
if !queueStarted {
monitor.start(queue: queue)
queueStarted = true
}
Output:
pathUpdateHandler = unsatisfied (Path was denied by NECP policy), interface: ipsec0, ipv4)
There's no internet connection.