Is there a way to get list of mac addresses of available bluetooth devices in ios? I'm working on a programm which finds people nearby using bluetooth mac addresses.
Asked
Active
Viewed 1,635 times
2
-
3Can you show what you have attempted so far – Adam Richardson Mar 26 '14 at 17:32
-
Not by MAC address but an automatically generated UUID. Also, note that there are lots of limitations but they are somewhat documented in the header files and in many-many stack overflow questions. So be ready to use google, it's your friend. – allprog Mar 27 '14 at 08:18
2 Answers
1
I'm sure you have:
[centralManager scanForPeripheralsWithServices:nil
options:nil];
That means your app is searching for BLE peripherals.
Every time your app discovers a peripheral invokes:
- (void)centralManager:(CBCentralManager *)central
didDiscoverPeripheral:(CBPeripheral *)peripheral
advertisementData:(NSDictionary *)advertisementData
RSSI:(NSNumber *)RSSI
You can add each discovered peripheral to an NSArray
of CBPeripheral

allprog
- 16,540
- 9
- 56
- 97

Gabriel.Massana
- 8,165
- 6
- 62
- 81
-
Note that according to what the user want, you won't get the MAC Addresses, since they are hashed (with a timestamp and the own iDevice MAC Address). – Larme Mar 26 '14 at 17:49
-
Sure he can only get the Service's UUIDs from advertisementData. – Gabriel.Massana Mar 26 '14 at 17:56
1
It is generally not possible, as iOS does not expose the Bluetooth address to the app.
If you are using non-iOS Bluetooth peripherals, you can manually include the BD_ADDR into the Manufacturer Info field of the advertising data. iOS exposes this manufacturer info, and you can get the BD_ADDR from there.
For many use cases, the UUID that iOS generates for each device is sufficient. If you could provide more details (possibly in a follow-up question), there may be a good chance that a solution can be found that does not need this workaround.

Etan
- 17,014
- 17
- 89
- 148