我的 iOS 应用程序有一个非常奇怪的行为。虽然在大多数情况下信标监控工作正常,但有时会在几个小时内连续触发didEnterRegion和didExitRegion事件多次。信标本身就在手机旁边(大约 15 厘米),所以根本不应该有didExitRegion。我知道可以释放触发退出的信标信号,但它在 3 分钟内触发了大约 5 次(进入和退出 - 所以 10 次调用)。这是一种非常罕见的行为,似乎是随机的。
信标来自Estimote,并通过 Estimote 应用程序设置为 -20dBm 的广播功率,应该是大约 3.5 米/12 英尺(根据 Estimote 应用程序)和 2000 毫秒的广告间隔。
我的 CLLocationManager 初始化
if (! _locationManager) {
_locationManager = [[CLLocationManager alloc] init];
if ([_locationManager respondsToSelector:@selector(setAllowsBackgroundLocationUpdates:)]) {
// Not available in iOS 8
_locationManager.allowsBackgroundLocationUpdates = YES;
}
// For iOS 8
if ([_locationManager respondsToSelector:@selector(requestAlwaysAuthorization)]) {
[_locationManager requestAlwaysAuthorization];
}
_locationManager.pausesLocationUpdatesAutomatically = NO;
_locationManager.delegate = self;
}
这就是我开始监控的方式
- (void)startMonitoringForBeaconRegions {
for (CLBeaconRegion *currentBeaconRegion in _beaconRegions) {
//default should be YES
currentBeaconRegion.notifyOnEntry = YES;
currentBeaconRegion.notifyOnExit = YES;
[_locationManager startMonitoringForRegion:currentBeaconRegion];
}
}
有没有人对他们的信标有类似的行为,也许有解决方案?
亲切的问候, Kyaak