iOS 9 didRangeBeacons 调用了更多次。 iOS-8 每秒一次

标签 ios objective-c cllocationmanager ios9 ibeacon

didRangeBeacons 方法在 iOS 9 中几乎每秒 40 次。然而,在 iOS 8 及更低版本中,它每秒仅被调用一次。因此,我们在 didRangeBeacons 中的代码逻辑未按预期工作。

重现步骤:

  1. 向您的任何 ViewController 或 AppDelegate 添加 CLLocationManager 委托(delegate)。
  2. 初始化位置管理器。
  3. 开始测距 -

    [self.locationManager startRangingBeaconsInRegion:savedRegion];
    
  4. 看看 didRangeBeacons 被调用的频率。

Expected Results: Should get called once every second.

Actual Results: Is getting called more than 40 times every second

版本: iOS 9 及更高版本

最佳答案

确保您没有更改 didRangeBeacons 方法中的任何 CLLocationManager 属性。这将导致 CLLocationManager 再次调用 didRangeBeacons,您将在一秒钟内完成大量更新。

我在“startUpdatingLocation”中遇到过这种情况,但应该有结果。

关于iOS 9 didRangeBeacons 调用了更多次。 iOS-8 每秒一次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32942945/

相关文章:

ios - NSDateFormatter MMM 转换

objective-c - 如何以编程方式将 NSTableColumn 绑定(bind)到 NSArrayControllerarrangedObjects?

ios - 当我将 CALayer I 添加到自定义 UIView 时,我隐藏了一个子 UIImageView

ios - 修复 iPhone/iPad/iPod 上的 CSS 悬停

objective-c - 具有 Bezeled 样式的 UISegmentedControl 使标题在设备上不居中

iphone - Xcode/iOS 模拟器 : Trigger significant location change manually

ios - iOS 8 中的 CLLocationManager 故障排除

ios - CLLocationManager#startMonitoringSignificantLocationChanges 是否提示用户访问 iPod Touch?

ios - 用于回答测验的 Apple 应用内购买

objective-c - 为什么我不能再释放一个对象?