在swift3中列出所有可用的无线网络SSID我试过但我只获得连接的无线网络SSID就可以了
func fetchSSIDInfo() -> String {
var currentSSID = ""
if let interfaces:CFArray = CNCopySupportedInterfaces() {
print(interfaces)
for i in 0..<CFArrayGetCount(interfaces){
let interfaceName: UnsafeRawPointer = CFArrayGetValueAtIndex(interfaces, i)
let rec = unsafeBitCast(interfaceName, to: AnyObject.self)
let unsafeInterfaceData = CNCopyCurrentNetworkInfo("\(rec)" as CFString)
if unsafeInterfaceData != nil {
let interfaceData = unsafeInterfaceData! as Dictionary!
for dictData in interfaceData! {
if dictData.key as! String == "SSID" {
currentSSID = dictData.value as! String
}
}
}
}
}
return currentSSID
}
答案 0 :(得分:0)
iOS仅返回已连接的SSID。无法在代码中获取其他SSID,无论是Swift还是ObjectiveC。
答案 1 :(得分:0)
根据Apple的理念,您无法访问硬件,因此您无法查询低级别的详细信息:您所要求的内容要求Apple公开他们认为不安全的低级别电话。 并且Yoy不能直接打电话给HW,也不能写一个驱动程序......