我正在开发一个将iBeacons用于室内导航的应用程序,我发现locationManager:rangingBeaconsDidFailForRegion:withError:
调用该函数的速率不够高,所以我要从CoreBluetooth中添加RSSI数据centralManager:didDiscoverPeripheral:advertisementData:RSSI:
.
我发现了一个奇怪的事实:当我使用CoreLocation监听iBeacon并记录外设ID时:
- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI { NSLog(@"%@, RSSI: %@", peripheral, RSSI);
在不同设备上报告每个信标具有不同的UUID:
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
我们的想法是将每个信标的UUID绑定到它的位置,因此这种行为非常具有功能性.
为什么物理上相同的信标(未关闭/打开)的UUID在不同设备上有所不同?这是预期的行为吗?如果是,我怎么能选择退出呢?
您无法使用读取标准iBeacons的标识符CoreBluetooth
.正如Chris Stratton在评论中所说,CoreBluetooth为您提供的UUID是一个设备UUID,它是由iOS每个会话随机生成的.它与iBeacon ProximityUUID无关.
有关您无法读取iBeacon标识符的详细信息,请CoreBluetooth
访问:http: //developer.radiusnetworks.com/2013/10/21/corebluetooth-doesnt-let-you-see-ibeacons.html
确实,您只能在每次locationManager:didRangeBeacons:inRegion:
回调时进行RSSI测量.这是进行自定义距离估计的真正障碍.在幕后,iOS可以为10BHz传输的iBeacons收集10倍的测量值.你是正确的,你可以使用更多的测量CoreBluetooth
,但问题是,没有可靠的方法来排列你看到的蓝牙设备CoreBluetooth
对应你可以看到的iBeacons CoreLocation
.