Using iBeacon and CoreLocation I'm receiving the following error:
Error Domain=kCLErrorDomain Code=16 "The operation couldn’t be completed. (kCLErrorDomain error 16.)
Unless I'm missing it, there doesn't seem to be a clear reference on Apple for what each of the error code means.
Can anyone interpret this error code?
The error calls from:
- (void)locationManager:(CLLocationManager *)manager rangingBeaconsDidFailForRegion: (CLBeaconRegion *)region withError:(NSError *)error{
NSLog(@"%@", error);
}
- (void)locationManager:(CLLocationManager *)manager monitoringDidFailForRegion:(CLRegion *)region withError:(NSError *)error{
NSLog(@"%@", error); }
Also, make sure that you have Background App Refresh enabled. For some reason with my iPhone 5s on iOS 7.1.1, beacons would not range when Background App Refresh is disabled, even if my app is in the foreground. Turning on App Refresh caused beacons to range again.
You can use the CLError enum and the error returned to your location manager to handle location errors in a specific and clear way.
It looks like this:
Thanks to @rmaddy for the CLError tip.
Look at the docs for
CLError
. Value 16 iskCLErrorRangingUnavailable
.The docs say: