Zeno
Zeno

Reputation: 11

Get UUID from mac address on iOS

I'm a new developer developing a BLE service on iOS and Android. Currently there is a problem that I am facing, that the device address on iOS is the UUID mapped from the mac address, and on Android it is the mac address of the device. So now is there a way on iOS, from the mac address I received can get the corresponding UUID? Thanks everyone!

I am not sure how to do it.

Upvotes: 1

Views: 2166

Answers (1)

Rob Napier
Rob Napier

Reputation: 299275

the device address on iOS is the UUID mapped from the mac address

This is incorrect. The peripheral ID is not "from" the MAC address. It's just a random UUID. It's not even stable (it can, and does, change over time, though not quickly). There is no way on iOS to get the MAC address of a BLE device, or even to absolutely uniquely identify a BLE device unless you control the firmware. If you do control the firmware, then you can provide some mechanism to uniquely identify the device over a protocol of your own design.

As a broad rule, you can use the peripheral ID to identify or connect to a device you've connected to before. This isn't 100%, because the ID does change sometimes. But for the most part it does work (and it's intended to work, so Apple won't just break this arbitrarily). But you cannot otherwise identify the device.

As a corollary, the peripheral ID on one iPhone is completely unrelated to the peripheral ID on another phone for the same device. This is intentional.

You will have to adjust your design to deal with these facts.

Upvotes: 3

Related Questions