【问题标题】:monitoringDidFailForRegion when regioning for iBeacon, kCLErrorDomain error 5为 iBeacon 进行区域划分时,monitoringDidFailForRegion,kCLErrorDomain 错误 5
【发布时间】:2014-05-26 14:08:33
【问题描述】:

我正在开发一个简单的应用程序,它使用 iOS7.1 中的 CoreLocation 来确定预设的 iBeacon。

我的代码运行良好,直到它突然停止。我没有更改代码中的任何内容。

在“ViewDidLoad”上开始监控后,“monitoringDidFailForRegion”上发生的错误是“kCLErrorDomain error 5”:

self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;

 NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:@"0E82E0A4-03FF-4A92-9C87-1F978917BD51"];
self.beaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:uuid identifier:@"com.henry.beacon"];
self.beaconRegion.notifyEntryStateOnDisplay = YES;

if ([CLLocationManager isMonitoringAvailableForClass:[CLBeaconRegion class]])
{
    NSLog(@"Monitoring is available.");
    [self.locationManager startMonitoringForRegion:self.beaconRegion];
    [self.locationManager requestStateForRegion:self.beaconRegion];
}

代理设置正确:

@interface ViewController : UIViewController <CLLocationManagerDelegate>

我检查了受监控的区域数量并

[[self.locationManager monitoredRegions] count]

向我显示当前正在监视 2 个区域。奇怪。

唯一有帮助的是重置 iOS 设备(iOS7.1 的 iPad Mini)。之后监控区域的数量又回到了1(应该是正确的)。

你们中是否有人遇到过同样的情况,我在代码中做错了什么?这是 iOS 7.1 中的错误吗?

感谢任何 cmets / 帮助。

亨利

更新:

我发现了另一个关于这个主题的帖子,它提供了一些有趣的见解:

iBeacon: didRangeBeacons stops getting called, must reset device for it to work again

好像真的是iOS7.1的一个bug。感谢你们的cmets。

【问题讨论】:

    标签: ios monitoring core-location ibeacon ios7.1


    【解决方案1】:

    检查您的蓝牙状态是打开还是关闭或蓝牙类型。可能是旧版本的蓝牙检查它。确保您的蓝牙已在设备中打开。这为我解决了这个错误。谢谢

    【讨论】:

      猜你喜欢
      • 2013-07-18
      • 2014-09-13
      • 2016-07-23
      • 2014-06-16
      • 1970-01-01
      • 2016-01-26
      • 2018-05-08
      • 2015-12-09
      • 1970-01-01
      相关资源
      最近更新 更多