Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift - get wifi security type

Tags:

ios

swift

iphone

Is there any way to detect if the wifi connection is secured using swift? is it possible to get the type security on the wifi? wpa, wep etc.

I get the ssid name in this way:

func getWiFiSsid() -> String? {

var ssid: String?

if let interfaces = CNCopySupportedInterfaces() as NSArray?
   for interface in interfaces {
       if let interfaceInfo = CNCopyCurrentNetworkInfo(interface as! CFString) as NSDictionary? {           
                ssid = interfaceInfo[kCNNetworkInfoKeySSID as String] as? String
                break
       }
   }
}
return ssid
}

Thanks.

like image 929
Gianluca Avatar asked Sep 21 '16 10:09

Gianluca


1 Answers

Not possible to get WiFi(current connected) security in CNCopySupportedInterfaces

Go to see the detail:

https://forums.developer.apple.com/message/342349#342349

like image 146
刘俊利 Avatar answered Oct 19 '22 05:10

刘俊利