UUIDs of iBeacons are different on different devices

蹲街弑〆低调 提交于 2019-12-23 00:25:13

问题


I'm developing an application that will use iBeacons for indoor navigation, and I found that the rate the function locationManager:rangingBeaconsDidFailForRegion:withError: is being called is not high enough, so I'm going to add the RSSI data from CoreBluetooth's centralManager:didDiscoverPeripheral:advertisementData:RSSI:.

And I found a curious fact: when I listen to the iBeacon with CoreLocation and log the peripheral id:

- (void)centralManager:(CBCentralManager *)central 
    didDiscoverPeripheral:(CBPeripheral *)peripheral 
    advertisementData:(NSDictionary *)advertisementData 
    RSSI:(NSNumber *)RSSI
{
    NSLog(@"%@, RSSI: %@", peripheral, RSSI);

each beacon is reported with different UUID on different devices:

A25804BD-D77A-5004-4C2C-301D996C7367 - my iPhone 5
843F4237-6059-9A5E-AA34-0BD92304BE1F - colleague's iPhone 5
77685805-C253-52BD-B787-8B95308834FB - other colleague's iPad mini

The idea was to bind UUID of each beacon to its location, so this behavior is quite functionality-breaking.

Why the UUID of physically the same beacon (not powered off/on) is different on different devices? Is it an expected behavior? If it is, how could I opt out of it?


回答1:


You cannot read the identifiers of standard iBeacons using CoreBluetooth. As Chris Stratton said in his comment, the UUID that CoreBluetooth gives you is a device UUID, which is randomly generated on a per-session basis by iOS. It has nothing to do with the iBeacon ProximityUUID.

More details on why you can't read iBeacon identifiers with CoreBluetooth are here: http://developer.radiusnetworks.com/2013/10/21/corebluetooth-doesnt-let-you-see-ibeacons.html

It is true that you only get on RSSI measurement per locationManager:didRangeBeacons:inRegion: callback. This is a real obstacle to doing a custom distance estimate. Behind the scenes, iOS can gather 10x as many measurements for iBeacons transmitting at 10Hz. You are correct that you can get more measurements using CoreBluetooth, but the problem is that there is no reliable way of lining up which bluetooth devices you see with CoreBluetooth correspond to the iBeacons you can see with CoreLocation.



来源:https://stackoverflow.com/questions/24265569/uuids-of-ibeacons-are-different-on-different-devices

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!