Search code examples
ipadwifireachabilitywwan

status of reachabilityForLocalWiFi is ReachableViaWWAN while on WIFI?


I need to detect if the device is connected to WIFI:

reach = [Reachability reachabilityForLocalWiFi];
status = [reach currentReachabilityStatus];

but the status is WWAN when I connect to WIFI on iPad, and there is no SIM inserted, I am about to test the status WITH a SIM.

Does anyone know the reason?

edit:

Just tried with a SIM card, it is still recognised as ReachableViaWWAN, but the actual connection is via 3G(the server only allows 3G connection, WIFI will fail), so I guess the Reachability may vary over time?


Solution

  • Finally I figured it out, the Reachability class I used is part of ASIHTTPRequest, which is a modified version, and it is modified in a way that a method is re-written but old method(with the same signature) is not removed, this does not make trouble(ie new method is called) until I created a static library for 3RD party libraries used in the project, which links the method declaration with the old method that does not fit into the modified framework of Reachability.