如何为许多信标声明Estimote数组 [英] How declare Estimote array for many beacons

查看:85
本文介绍了如何为许多信标声明Estimote数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到此问题估计值:使用ESTBeaconRegion和startRangingBeaconsInRegion检测多个信标?

我尝试提供的答案,但是当我创建了三个区域(例如:从该示例代码beacon1Region,beacon2Region,beacon3Region)并为每个区域添加了"EstimoteSampleRegion"(例如:EstimoteSampleRegion1,EstimoteSampleRegion2,EstimoteSampleRegion3)时,我只能先获得作为结果(在索引0中),当我启动RangingBeaconsInRegion.

I try that answer provided but when I made three regions (eg: from that sample code beacon1Region, beacon2Region, beacon3Region) and include that "EstimoteSampleRegion" for each (eg: EstimoteSampleRegion1, EstimoteSampleRegion2, EstimoteSampleRegion3) I can only get first beacon as result (in index 0) when I startRangingBeaconsInRegion.

如何使它正常工作?我应该在一个数组中列出全部用于单个区域的三个估计样本区域(例如:"beaconRegion"),然后使用[self.beaconManager startRangingBeaconsInRegion:beaconRegion]在该单个区域中查找三个信标吗?
如果是,则显示的代码声明一个区域具有多个信标的数组吗?

How can I make this to work? should I list that three estimote sample regions in one array that is all for a single region (eg: "beaconRegion") and then look in that single region for the three beacons with [self.beaconManager startRangingBeaconsInRegion:beaconRegion]?
If yes, what is code that show declare that array with many beacons for one region?

还是我应该创建三个beaconManager实例,并且每个信标都有自己的区域?我这样做的问题是我只能看到第一个信标.不是三个.

Or should I make three beaconManager Instances and each beacons has its own region? Problem when I do this is I can only see first beacon. not three.

推荐答案

之所以只获得第一个信标,是因为您位于不同的地区,而这正是iOS识别您要查找的内容的原因. 即使使用CoreLocation和一个CLLocationManager,您也会在委托方法的数组中获得一个信标.

The reason why you get only first beacon is because you are ranging different regions and this is how iOS recognizes what are you looking for. Even using CoreLocation and one CLLocationManager you will get one beacon in array in delegate method.

您可以将远程信标添加到自己的数组中,例如,它可以是模型中的属性.

You can add ranged beacon to your own array, which can be property in your model, for example.

或者我应该创建三个beaconManager实例,每个信标具有 它自己的区域?我这样做的问题是我只能看到第一个信标. 不是三个.

Or should I make three beaconManager Instances and each beacons has its own region? Problem when I do this is I can only see first beacon. not three.

是的,这可以通过这种方式完成.然后,您实现

Yes, this can be done this way. You then implement

- (void)beaconManager:(ESTBeaconManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(ESTBeaconRegion *)region

,该方法将每1秒钟为每个信标管理器调用一次.在当前的beacons数组中,将只有一个对象,但毕竟您获得了所有的信标. 与上述相同,您可以将远程信标添加到自己的数组中,例如,它可以是模型中的属性.

and that method will be called one time for every beacon manager every 1 second. In current beacons array there will be only one object but after all you get all of your beacons. And the same as above, you can add ranged beacon to your own array, which can be property in your model, for example.

如果信标具有相同的主号(和不同的副号),则可以使用此方法:

If your beacons have the same major number (and different minor numbers) you can the use this method:

[self.manager startRangingBeaconsInRegion:[[ESTBeaconRegion alloc] initWithProximityUUID:ESTIMOTE_PROXIMITY_UUID major:713 identifier:@"Multiple Beacons"]];

之后

- (void)beaconManager:(ESTBeaconManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(ESTBeaconRegion *)region

您将在其中拥有多个信标的阵列(当然,如果您在iOS设备附近有它们的话).

you will get array with more than one beacon inside (of course if you have them near you iOS device).

这篇关于如何为许多信标声明Estimote数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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