本文介绍了didEnterRegion和didRangeBeacons之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在用例方面,didEnterRegion和didRangeBeacons之间的确切区别是什么,我的意思是什么时候应该实现didEnterRegion / didExitRegion以及什么时候应该实现didRangeBeacons?

What is the exact difference between didEnterRegion and didRangeBeacons in terms of use case i mean when i should implement didEnterRegion/didExitRegion and when should i implement didRangeBeacons ?

每个委托方法的确切功能是什么?从苹果的文档来看还不太清楚。

What are the each delegate method's exact functionality ? From apple's documentation it's not very clear.

- (void)locationManager:(CLLocationManager *)manager
         didEnterRegion:(CLRegion *)region
{
} 

AND

- (void)locationManager:(CLLocationManager *)manager
        didRangeBeacons:(NSArray *)beacons
               inRegion:(CLBeaconRegion *)region
{
}


推荐答案

当您越过区域的阈值(即检测到信标)时,将调用 didEnterRegion 一次。一旦退出该区域(即不再显示信标),将调用 didExitRegion ,然后调用 didEnterRegion 如果您再次进入该区域,请再次输入。

didEnterRegion will be called once when you cross the threshold of the region (i.e. detect the beacon). Once you exit the region (i.e. the beacon is no longer visible) didExitRegion will be called and then didEnterRegion will be called again if you re-enter the region.

didRangeBeacons 被反复调用,而您所看到的信标可见,从而为您提供了更新的邻近信息。

didRangeBeacons is called repeatedly while beacons that you are ranging are visible, giving you updated proximity information.

一种常见的策略是监视信标区域,并在调用 didEnterRegion 之后,开始对该信标进行范围更新,

A common strategy is to monitor for beacon regions and once didEnterRegion is called, start ranging that beacon for updates, stopping the ranging once didExitRegion is called.

另请参见-

这篇关于didEnterRegion和didRangeBeacons之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 10:09