I have a problem with the different behavior when using SCNetworkReachability if the iPhone is running a packet tunnel based on NEPacketTunnelNetwork
var flags: SCNetworkReachabilityFlags =
SCNetworkReachabilityFlags(rawValue: 0)
let isReachable = flags == .reachable
let needsConnection = flags == .connectionRequired
return isReachable && !needsConnection
if I use the [let isReachable = flags == .reachable],
The resulte of isReachable will be False
However,if I use the code of [let isReachable = (flags.rawValue & UInt32(kSCNetworkFlagsReachable)) != 0] like below.
The result will be True
var flags: SCNetworkReachabilityFlags =SCNetworkReachabilityFlags(rawValue: 0)
let isReachable = (flags.rawValue & UInt32(kSCNetworkFlagsReachable)) != 0
let needsConnection = flags == .connectionRequired
return isReachable && !needsConnection
The API reference the [reachable] and [kSCNetworkFlagsReachable] has the same describe :
"The specified node name or address can be reached using the current network configuration"
Can anybady tell me which one is the correct behavior that should be used?