Please tell me, how can I know if a "wifi" adapter working at the moment in objective-c or swift?
Thanks!
Please tell me, how can I know if a "wifi" adapter working at the moment in objective-c or swift?
Thanks!
The Reachablity sample is a good place to start. Within the Reachablity sample the code is spread out and doesn't show you how to handle the simplest case. For the simplest case (not listening to changes in state) I can save you the effort of having to collate the right lines yourself.
Copy the Reachability class from the Reachablity sample into your project, include it in your class, and use the following code:
if ([[Reachability reachabilityForLocalWiFi] currentReachabilityStatus] != ReachableViaWiFi) {
//Code to execute if WiFi is not enabled
}
Find Reachability here :