I am using the following to detect Wifi/Non-wifi and no matter what I do, it is always returning Wifi:
Code:
SCNetworkReachabilityRef scRef;
SCNetworkConnectionFlags scFlags;
scRef = SCNetworkReachabilityCreateWithName(kCFAllocatorDefault, URL);
if (scRef) {
SCNetworkReachabilityGetFlags(scRef, &scFlags);
if ((scFlags & kSCNetworkReachabilityFlagsIsWWAN) != 0) {
// we are on 3G
connType = [NSString stringWithFormat:@"&wifi=no"];
} else {
// we are not on 3G
connType = [NSString stringWithFormat:@"&wifi=yes"];
}
CFRelease(scRef);
}
Any one have any ideas why? It looks like scFlags is always returning (null).
Thanks in advance.