1.import SystemConfiguration.CaptiveNetwork
// 获取当前wifi名称
func getWifiName() -> String? {
let interfaces: CFArray! = CNCopySupportedInterfaces()
if interfaces == nil { return nil }
let if0: UnsafePointer? = CFArrayGetValueAtIndex(interfaces, 0)
if if0 == nil { return nil }
let interfaceName: CFStringRef = unsafeBitCast(if0!, CFStringRef.self)
let dictionary = CNCopyCurrentNetworkInfo(interfaceName) as NSDictionary?
if dictionary == nil { return nil }
return dictionary?[kCNNetworkInfoKeySSID as String] as? String
}