monitoringDidFailForRegion when regioning for iBeacon, kCLErrorDomain error 5

不羁岁月 提交于 2019-12-05 02:22:52

问题


I am working on a simple App that uses CoreLocation in iOS7.1 to determine a pre-set iBeacon.

My Code did work very well until it suddenly stopped. I didn't change anything in the code.

The Error occured was "kCLErrorDomain error 5" on "monitoringDidFailForRegion" after start monitoring on "ViewDidLoad":

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];
}

Delegate is set up correctly:

@interface ViewController : UIViewController <CLLocationManagerDelegate>

I checked the number of regions that are monitored and

[[self.locationManager monitoredRegions] count]

showed me that 2 regions are currently being monitored. Strange.

The only thing that helped was resetting the iOS device (iPad Mini with iOS7.1). After that the number of monitored regions is back to 1 (which should be correct).

Does anyone of you encounter the same and am I doing something wrong in my code? Is this a bug in iOS 7.1?

Thanks for any comments / help.

Henry

Update:

I found another thread on this subject, which gave some interesting insights:

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

It seems as if it really is a bug in iOS7.1. Thanks for your comments on this.


回答1:


Check Your status of bluetooth is it open or close or type of Bluetooth. Might be old version of bluetooth check it. Make sure your bluetooth is open in device. This solve this error for me. Thanks



来源:https://stackoverflow.com/questions/23029197/monitoringdidfailforregion-when-regioning-for-ibeacon-kclerrordomain-error-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!