Estimote:使用ESTBeaconRegion和startRangingBeaconsInRegion检测多个信标?

 伤不起饼子_132 发布于 2023-01-18 18:11

初学者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添加和检测多个信标,我将非常感谢一个代码示例,它解释了如何执行此操作.

1 个回答
  • 轻松修复!您identifier: @"EstimoteSampleRegion"]必须为所有三个区域使用不同的字符串.

    无论是使用Estimote SDK还是标准iOS CoreLocationAPI,Estimote SDK只是一个薄的包装器都是如此. CoreLocation通过使用该字符串标识符作为键来跟踪多个区域.如果您多次使用相同的字符串,则实际上是在告诉CoreLocation您将一个区域替换为另一个区域.

    无耻的插件:如果您使用我公司的ProximityKit框架,您不必在代码中管理您的信标区域 - 您可以在云中动态地执行此操作.然后,您再也不必担心保持此标识符的唯一性.它与Estimote信标以及所有标准iBeacon兼容.

    2023-01-18 18:13 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有