ios - didEnterRegion 和 didRangeBeacons 之间的区别

标签 ios cllocationmanager ibeacon clbeacon clbeaconregion

在用例方面,didEnterRegion 和 didRangeBeacons 之间的确切区别是什么?

每个委托(delegate)方法的确切功能是什么?从苹果的文档看不是很清楚。

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

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

最佳答案

didEnterRegion 将在您越过区域阈值时调用一次(即检测到信标)。一旦您离开该区域(即信标不再可见),didExitRegion 将被调用,然后如果您重新进入该区域,didEnterRegion 将被再次调用。

didRangeBeacons 在您测距的信标可见时被重复调用,为您提供更新的邻近信息。

一个常见的策略是监视信标区域,一旦 didEnterRegion 被调用,就开始测距该信标以进行更新,一旦 didExitRegion 被调用就停止测距。

另见 - The Location Programming Guide

关于ios - didEnterRegion 和 didRangeBeacons 之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26251076/

相关文章:

ios - Swift collectionView 选择单元格多选

ios - 无法在 google firebase 中存储 facebook 用户数据

objective-c - 等到 UI 更新后再删除 UIActivityIndi​​cator

ios - iPhone 模拟器中的 startMonitoringForRegion

iOS Swift - CLLocationManager 仅显示在两个 ViewController 之一上

android - 使用蓝牙的室内定位系统,无需额外设备(例如 ibeacon)

ios - StoryBoard 中的自定义 Table ViewController

iphone - 在设置中临时禁用后 CLLocationManager 不返回位置

android - iOS/Android 上的信标通知

ios - swift :信标测距在打电话时返回空数组