获取连接的 wifi 路由器的制造商名称
Get connected wifi Router's manufacturer name
我正在开发需要获取移动 wifi 路由器制造商名称的应用程序(例如:Kasda Network Inc 或 Huawei technologies co. ltd)。这里有一个 app,它显示如下所示的供应商名称。
我如何才能获得有关供应商的确切信息,如下所示
试试这个
import SystemConfiguration.CaptiveNetwork
func getSSID() -> String? {
let interfaces = CNCopySupportedInterfaces()
if interfaces == nil {
return nil
}
let interfacesArray = interfaces as! [String]
if interfacesArray.count <= 0 {
return nil
}
let interfaceName = interfacesArray[0] as String
let unsafeInterfaceData = CNCopyCurrentNetworkInfo(interfaceName as CFString)
if unsafeInterfaceData == nil {
return nil
}
let interfaceData = unsafeInterfaceData as! Dictionary <String,AnyObject>
return interfaceData["SSID"] as? String
}
问题包含两部分。
1:如何获取Mac连接的wifi地址
2:根据 Mac 地址获取制造商名称
1:正在获取 Mac 地址
func getConnectedWifiMacAdrees()-> [String:String]{
var informationDictionary = [String:String]()
let informationArray:NSArray? = CNCopySupportedInterfaces()
if let information = informationArray {
let dict:NSDictionary? = CNCopyCurrentNetworkInfo(information[0] as! CFString)
if let temp = dict {
informationDictionary["BSSID"] = String(temp["BSSID"]as!String)
return informationDictionary
}
}
return informationDictionary
}
注意::导入SystemConfiguration.CaptiveNetwork
我正在开发需要获取移动 wifi 路由器制造商名称的应用程序(例如:Kasda Network Inc 或 Huawei technologies co. ltd)。这里有一个 app,它显示如下所示的供应商名称。
我如何才能获得有关供应商的确切信息,如下所示
试试这个
import SystemConfiguration.CaptiveNetwork
func getSSID() -> String? {
let interfaces = CNCopySupportedInterfaces()
if interfaces == nil {
return nil
}
let interfacesArray = interfaces as! [String]
if interfacesArray.count <= 0 {
return nil
}
let interfaceName = interfacesArray[0] as String
let unsafeInterfaceData = CNCopyCurrentNetworkInfo(interfaceName as CFString)
if unsafeInterfaceData == nil {
return nil
}
let interfaceData = unsafeInterfaceData as! Dictionary <String,AnyObject>
return interfaceData["SSID"] as? String
}
问题包含两部分。
1:如何获取Mac连接的wifi地址
2:根据 Mac 地址获取制造商名称
1:正在获取 Mac 地址
func getConnectedWifiMacAdrees()-> [String:String]{
var informationDictionary = [String:String]()
let informationArray:NSArray? = CNCopySupportedInterfaces()
if let information = informationArray {
let dict:NSDictionary? = CNCopyCurrentNetworkInfo(information[0] as! CFString)
if let temp = dict {
informationDictionary["BSSID"] = String(temp["BSSID"]as!String)
return informationDictionary
}
}
return informationDictionary
}
注意::导入SystemConfiguration.CaptiveNetwork