funcgetSSID()->String?{ letinterfaces:CFArray!=CNCopySupportedInterfaces()?.takeRetainedValue() ifinterfaces==nil{returnnil} letif0:UnsafePointer<Void>?=CFArrayGetValueAtIndex(interfaces,0) ifif0==nil{returnnil} letinterfaceName:CFStringRef=unsafeBitCast(if0!,CFStringRef.self) letdictionary=CNCopyCurrentNetworkInfo(interfaceName)?.takeRetainedValue()asNSDictionary? ifdictionary==nil{returnnil} returndictionary?[kCNNetworkInfoKeySSIDasString]as?String }
- -
项目中遇到了 那就随手记一下
原文链接:https://www.f2er.com/swift/327637.html