Estimote:使用ESTBeaconRegion和startRangingBeaconsInRegion检测多个信标? [英] Estimote: detecting multiple beacons with ESTBeaconRegion and startRangingBeaconsInRegion?

查看:324
本文介绍了Estimote:使用ESTBeaconRegion和startRangingBeaconsInRegion检测多个信标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

初学者Estimote问题:添加多个Estimote信标及其各自的主要/未成年人的正确方法是什么,以便可以使用startRangingBeaconsInRegion单独检测所有信标?

Beginner Estimote question: What is the correct approach for adding multiple Estimote beacons, with their respective major/minors, so that all beacons can be detected separately using startRangingBeaconsInRegion?

此代码适用于单个信标:

This code works fine for a single beacon:

// Single Beacon Region
ESTBeaconRegion* beaconRegion = [[ESTBeaconRegion alloc] initWithProximityUUID:ESTIMOTE_PROXIMITY_UUID
                                                                    major:11111 minor:11111
                                                                    identifier: @"EstimoteSampleRegion"];
// Start ranging beacons
[self.beaconManager startRangingBeaconsInRegion:beaconRegion];

但是此代码不适用于多个信标:

However this code does not work for multiple beacons:

// 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。)

With this code only the last beacon is detected. (So in this case, only beacon3Region is detected).

-

如果您知道如何添加和使用ESTBeaconRegion和startRangingBeaconsInRegion检测多个信标我会很感激代码示例,它解释了如何执行此操作。

If you know how to add and detect multiple beacons with ESTBeaconRegion and startRangingBeaconsInRegion I would appreciate a code example that explains how to do this.

推荐答案

轻松修复!您的标识符:@EstimoteSampleRegion] 必须为所有三个区域使用不同的字符串。

Easy fix! Your identifier: @"EstimoteSampleRegion"] must use a different string for all three regions.

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

This is true whether using the Estimote SDK or standard iOS CoreLocation APIs, around which the Estimote SDK is just a thin wrapper. CoreLocation keeps track of multiple regions by using that string identifier as a key. If you use the same string more than once, you are effectively telling CoreLocation to replace one region with another region.

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

Shameless plug: if you use my company's ProximityKit framework, you do not have to manage your beacon regions at all in code -- you can do so dynamically in the cloud. You then no longer have to worry about keeping this identifier unique. It is compatible with Estimote beacons as well as all standard iBeacons, too.

这篇关于Estimote:使用ESTBeaconRegion和startRangingBeaconsInRegion检测多个信标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆