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.