I hope you all realize that code won’t work in certain countries (such as China), or anywhere else where GOOGLE.COM is blocked, which is alot of places outside US/Canada/SouthAmerica and Europe
So if flags=2 then the network CAN be reached, but there is no connection?
it would have to be isWWAN and/or isLocalAddress to be either a cell connection or wifi connection?
I found swift code, but it returns 2 but doesn’t “care” as long as the value is “2”
and I don’t know if this helps… but instead of SCNetworkReachabilityCreateWithName with requires “GOOGLE.COM”
this uses
var zeroAddress = sockaddr_in()
zeroAddress.sin_len = UInt8(sizeofValue(zeroAddress))
zeroAddress.sin_family = sa_family_t(AF_INET)
let defaultRouteReachability = withUnsafePointer(&zeroAddress) {
SCNetworkReachabilityCreateWithAddress(nil, UnsafePointer($0))
}
var flags = SCNetworkReachabilityFlags()
my iTouch returns 0 if wifi is off , and 2 if WiFi is on… shouldn’t it return 65536 if Wifi is on?