Estimote:使用ESTBeaconRegion和startRangingBeaconsInRegion检测多个信标?
初学者Estimote问题:添加多个Estimote信标及其各自的主要/未成年人的正确方法是什么,以便可以使用startRangingBeaconsInRegion单独检测所有信标?
此代码适用于单个信标:
// Single Beacon Region ESTBeaconRegion* beaconRegion = [[ESTBeaconRegion alloc] initWithProximityUUID:ESTIMOTE_PROXIMITY_UUID major:11111 minor:11111 identifier: @"EstimoteSampleRegion"]; // Start ranging beacons [self.beaconManager startRangingBeaconsInRegion:beaconRegion];
但是,此代码不适用于多个信标:
// Beacon 1 Region ESTBeaconRegion* beacon1Region = [[ESTBeaconRegion alloc] initWithProximityUUID:ESTIMOTE_PROXIMITY_UUID major:11111 minor:11111 identifier: @"EstimoteSampleRegion"]; // Beacon 2 Region ESTBeaconRegion* beacon2Region = [[ESTBeaconRegion alloc] initWithProximityUUID:ESTIMOTE_PROXIMITY_UUID major:22222 minor:22222 identifier: @"EstimoteSampleRegion"]; // Beacon 3 Region ESTBeaconRegion* beacon3Region = [[ESTBeaconRegion alloc] initWithProximityUUID:ESTIMOTE_PROXIMITY_UUID major:33333 minor:33333 identifier: @"EstimoteSampleRegion"]; // Start ranging beacons [self.beaconManager startRangingBeaconsInRegion:beacon1Region]; [self.beaconManager startRangingBeaconsInRegion:beacon2Region]; [self.beaconManager startRangingBeaconsInRegion:beacon3Region];
使用此代码,仅检测到最后一个信标。 (所以在这种情况下,只检测到beacon3Region)。
–
如果您知道如何使用ESTBeaconRegion和startRangingBeaconsInRegion添加和检测多个信标,我将非常感谢一个解释如何执行此操作的代码示例。
轻松修复! 您的identifier: @"EstimoteSampleRegion"]
必须为所有三个区域使用不同的字符串。
无论是使用Estimote SDK还是标准iOS CoreLocation
API都是如此,Estimote SDK只是一个很薄的包装器。 CoreLocation
通过将该字符串标识符用作键来跟踪多个区域。 如果您多次使用相同的字符串,则实际上是在告诉CoreLocation
将一个区域替换为另一个区域。
无耻插件:如果您使用我公司的ProximityKit框架,您无需在代码中管理您的信标区域 – 您可以在云中动态地执行此操作。 然后,您再也不必担心保持此标识符的唯一性。 它与Estimote信标以及所有标准iBeacon兼容。
- 如何使用.plist在App Store外部下载和安装.ipa
- UISearchBarDelegate showsSearchResultsButton属性的正确用法是什么?
- MPMoviePlayerController在iOS6中进入全屏后中断/停止
- 在iOS上创build方形视图的自定义相机
- 如何捕获UIPanGestureRecognizer中最初点击的点?
- 使用Swift以编程方式闪烁屏幕(在“屏幕截图”上)
- 当以编程方式将UITextField设置为FirstResponder时,会在文本编辑上造成一些奇怪的操作
- 试图将完成button添加到数字键盘
- 使用UITabBarController但状态栏覆盖视图