Preamble
I'm working on Xcode 7.0.1 with Swift 2
Are hours (update, days) that I try to understand how I can retrieve this information.
I have seen that there is a framework, CoreBluetooth, that maybe could help me. (update, definitely not!!)
Any idea? Objective-c/swift/c/c++.. whatever.. is the same.
I already test code in this answer but prints:
>>> WIFI MAC ADDRESS: 02:00:00:00:00:00
>>> IPHONE BLUETOOTH MAC ADDRESS: 02:00:00:00:00:ffffffff
>>> IPAD BLUETOOTH MAC ADDRESS: 02:00:00:00:00:01
About this, I have read on official documentation:
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.)
The question is: if other devices can read my bluetooth mac address, why I'm not able to?
I think that there should be a way to do it, for sure.
I also try snippets on this answer (and other answers) but I never get real mac address.
I know that to know bluetooth information of mac I can run on terminal:
system_profiler SPBluetoothDataType | sed -n "/Apple Bluetooth Software Version\:/,/Manufacturer\:/p"
And to retrieve mac address only I can 'pipe' to previous command:
egrep -o '([[:xdigit:]]{1,2}-){5}[[:xdigit:]]{1,2}'
I'm asking.. can I run this command on iPhone programmatically?
Actually, I have already tried, with this pseudocode:
script = ""
system("system_profiler SPBluetoothDataType > blueInfo.txt")
sleep
read from file "blueInfo.txt" its content
This code compile and "works", but fail on reading file that does not exist.
I'm currently thinking about dropping ):