I just want to know if the wifi is switch on, because my app just want users switch on the wifi button, they don't need to connect a wifi at all.. but i just cant get the message whether user have already switch the wifi on..
Asked
Active
Viewed 63 times
-2
-
What you mean by this "my app just want users switch on the wifi button, they don't need to connect a wifi at all". Actually what are you trying to implement?. – Nitheesh George Mar 31 '15 at 09:05
-
@Nitheesh George I just want to know whether the mobile wifi is open, if have not available wifi it just open but not connected@greg-449 – malaimo feng Mar 31 '15 at 09:20
2 Answers
0
Use Rechability class,which is a drop-in replacement for Apple's Reachability class. It is ARC-compatible, and it uses the new GCD methods to notify of network interface changes.
Once download and check the below link.
0
To check internet connectivity use the following code
Reachability *networkReachability = [Reachability reachabilityForInternetConnection];
NetworkStatus networkStatus = [networkReachability currentReachabilityStatus];
if (networkStatus == NotReachable) {
NSLog(@"Internet connection available");
} else {
NSLog(@"Internet connection not available");
}
Check the sample code from Apple Reachability

Nitheesh George
- 1,357
- 10
- 13
-
I want to know whether wifi is enabled like this question http://stackoverflow.com/questions/8744658/detect-wifi-enabled-regardless-of-whether-its-connected?rq=1 – malaimo feng Mar 31 '15 at 09:33
-
Then use the method in reachability [Reachability reachabilityWithHostName:(NSString *)hostName]; to check www.google.com is reachable. if so you connected to internet. – Nitheesh George Mar 31 '15 at 09:43