我可以通过编程方式获取连接到手机的wifi的MAC地址吗? [英] Can I programmatically get the MAC address of wifi which is connected to my phone?

查看:97
本文介绍了我可以通过编程方式获取连接到手机的wifi的MAC地址吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的手机已连接到wifi.我想获取wifi的mac地址.

My phone is connected to wifi.I want to get mac address of my wifi.

推荐答案

BSSID和mac地址是同一回事. 您可以从此功能获取mac地址. 只需导入SystemConfiguration.CaptiveNetwork

BSSID and mac address is same thing. You can get mac address from this function. just import 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
}

这篇关于我可以通过编程方式获取连接到手机的wifi的MAC地址吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆