iOS another way to get mac address after iOS 7.
Since iOS 7.0, you cannot easily using sysctl()
or ioctl()
to get MAC address(normal way).
Link (the most bottom)
In iOS 7 and later, if you ask for the MAC address of an iOS device, the system returns the value 02:00:00:00:00:00.
If you need to identify the device, use the identifierForVendor property of UIDevice instead.
(Apps that need an identifier for their own advertising purposes should consider using the advertisingIdentifier property of ASIdentifierManager instead.)
- Connect to any Wi-Fi.
- Get current IP address of Wi-Fi.
- Send ICMP echo request(ping) to the IP address.(not the IP address, 127.0.0.1)
- Walk whole ARP table to search the MAC address of current IP address of Wi-Fi.
- Get your MAC address.
- Connect to any Wi-Fi.
- Get current IP address of Wi-Fi.
- Send ICMP echo request(ping) to the IP address.(not the IP address, 127.0.0.1)
- Get an ARP entry by current IP address of Wi-Fi.
- Get your MAC address.
- Connect to any Wi-Fi.
- Get current IP address of Wi-Fi.
- Send MDNS query that question "_apple-mobdev2._tcp.local" with PTR record.
- Response data will content MAC address.
- Get your MAC address.