My phone is connected to wifi.I want to get mac address of my wifi.
Asked
Active
Viewed 5,421 times
-5
-
1http://stackoverflow.com/a/29164734/6469239 – user12345625 Jan 07 '17 at 09:38
-
yes it is duplicate but is it possible or not? – Anis Mansuri Jan 07 '17 at 09:41
-
1@AnisMansuri It's not possible after iOS 7.0. If you request the mac ID, you'll always get `02:00:00:00:00:00`. Check the answer in the link above. – ebby94 Jan 07 '17 at 09:42
-
1@ebby94 that sentence is for device mac address. I'm talking about wifi mac address. Both are different. Check last paragraph of this document. (https://developer.apple.com/library/content/releasenotes/General/WhatsNewIniOS/Articles/iOS7.html#//apple_ref/doc/uid/TP40013162-SW1) – Anis Mansuri Jan 07 '17 at 09:46
-
Check this answer http://stackoverflow.com/a/16474591/3066450 – ebby94 Jan 07 '17 at 09:51
-
MAC of Wifi xD nice one. Do you mean IP address? if soo look at http://stackoverflow.com/questions/6807788/how-to-get-ip-address-of-iphone-programatically – Axel Jan 07 '17 at 11:09
-
Possible duplicate of [Is it possible to get the SSID & MAC Address of Currently connected WiFi Network in an App](http://stackoverflow.com/questions/16470615/is-it-possible-to-get-the-ssid-mac-address-of-currently-connected-wifi-network) – NobodyNada Jan 07 '17 at 16:41
1 Answers
6
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
}

Anis Mansuri
- 97
- 1
- 10
-
Works well on real device. On simulator it returns empty data. Thanks for help! :) – piotr_ch Oct 17 '17 at 12:08
-
2In order to use this you need to add `import SystemConfiguration.CaptiveNetwork` – bcattle Nov 29 '17 at 22:33
-