Here's the code snippet. Below.
// Initialize the region with the Estimote iBeacon manually generated UUID of 16 bytes size.
NSUUID *estimoteUUID = [[NSUUID alloc] initWithUUIDString:[Repository getiBeaconRegionUUID]];
_beaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:estimoteUUID
identifier:@"A"];
// Launch app when display is turned on and inside region.
_beaconRegion.notifyEntryStateOnDisplay = YES;
// Create a location manager
_locationManager = [[CLLocationManager alloc] init];
// Set delegate
_locationManager.delegate = self;
if ([CLLocationManager isMonitoringAvailableForClass:[CLBeaconRegion class]])
{
[_locationManager requestAlwaysAuthorization];
[_locationManager startMonitoringForRegion:_beaconRegion];
// Get status update right away for UI
[_locationManager requestStateForRegion:_beaconRegion];
}
else
NSLog(@"This device does not support monitoring beacon regions");
There is the NSLocationAlwaysUsageDescription
added to the app. plist.
There was never the dialog with the text from the key above.
In Settings => Privacy => Location Services for the app. was turned off after the first app. run.
The delegate method
- (void)locationManager:(CLLocationManager *)manager
didDetermineState:(CLRegionState)state
forRegion:(CLRegion *)region
is never called.
In iOS 7 the same app. worked without the authorization request.
Share your experience.
After I added NSLocationAlwaysUsageDescription
key-value pair into InfoPlist.strings
it showed the dialog and started to work.