我的手机已连接到 wifi。我想获取我的 wifi 的 MAC 地址。
BSSID 和 mac 地址是同一回事。
您可以通过此函数获取 mac 地址。
只需导入 SystemConfiguration.CaptiveNetwork
func getWIFIInformation() -> [String:String]{
var informationDictionary = [String:String]()
let informationArray:NSArray? = CNCopySupportedInterfaces()
if let information = informationArray {
let dict:NSDictionary? = CNCopyCurrentNetworkInfo(information[0] as! CFStringRef)
if let temp = dict {
informationDictionary["SSID"] = String(temp["SSID"]!)
informationDictionary["BSSID"] = String(temp["BSSID"]!)
return informationDictionary
}
}
return informationDictionary
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)