iBeacon和iOS 9

iBeacon和iOS 9,ios,bluetooth,core-location,ibeacon,Ios,Bluetooth,Core Location,Ibeacon,我目前正在开发需要iBeacon监控的应用程序 一年前,我使用iOS 8.x SDK编写了这个应用程序。 它本来可以正常工作,但现在,一年后,同样的代码不再工作了(我正在用同样的信标测试它!) 信标区域检测变得更加不可预测。 它有自己的意志 有些信标被检测到,有些被忽略 我在OpenRadar上找不到任何相关信息 但是苹果公司再也没有回到他们身边 想法 这就是我初始化位置管理器的方式 self.locationManager = [CLLocationManager new]; self.loc

我目前正在开发需要iBeacon监控的应用程序

一年前,我使用iOS 8.x SDK编写了这个应用程序。 它本来可以正常工作,但现在,一年后,同样的代码不再工作了(我正在用同样的信标测试它!)

信标区域检测变得更加不可预测。 它有自己的意志

有些信标被检测到,有些被忽略

我在OpenRadar上找不到任何相关信息

但是苹果公司再也没有回到他们身边

想法

这就是我初始化位置管理器的方式

self.locationManager = [CLLocationManager new];
self.locationManager.delegate = self;

// Worst accuracy is set in order to preserve battery life.

self.locationManager.desiredAccuracy = kCLLocationAccuracyThreeKilometers;
self.locationManager.allowsBackgroundLocationUpdates = YES;

// Required to keep the app living in the background.
// Background mode "Location Updates" is enabled.

[self.locationManager startUpdatingLocation];

我想在你使用地理围栏或环形区域之前。核心位置不需要任何代码来检测iBeacons。尝试如下设置:

self.locationManager = [CLLocationManager new];
self.locationManager.delegate = self;
[self.locationManager startMonitoringForRegion:beaconRegion]; // Where "beaconRegion" is a CLBeaconRegion with a UUID that matches the beacon you want to detect (major & minor optional)
beaconRegion.notifyEntryStateOnDisplay = YES;
beaconRegion.notifyOnEntry = YES;
beaconRegion.notifyOnExit = YES;
您还需要将NSLocationAlwaysUsageDescription添加到info.plist中。完成所有这些之后,您应该开始通过以下两种方法获取信标的进入和退出事件:

- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region;
- (void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region;

你的应用程序的用途是什么?@MihirOza是否相关?它在保密协议下,我不能谈论它。你试过使用不同的。desiredAccuracy precision吗?@UlyssesR影响位置更新,而不是信标测距。位置更新的唯一目的是让应用程序在后台保持“感知”(“位置更新”后台模式处于启用状态),以便调用
CLLocationManager
委托方法。您是否尝试运行可以检测和配置信标的第三方应用程序?这将是有趣的,看看他们是否也不能检测到相同的信标。