0

I am not getting region entry and exit events for beacon regions. This is how I add the beacon to the monitoredRegions:

NSUUID *uuid = [[NSUUID alloc] initWithUUIDString: beacon.UUID];
CLBeaconRegion *region = [[CLBeaconRegion alloc] initWithProximityUUID:      uuid major: (CLBeaconMajorValue) beacon.major  minor: (CLBeaconMajorValue) beacon.minor  identifier:  @"SOME IDENTIFIER"];

[_locationManager startMonitoringForRegion: region];

and events:

- (void) locationManager: (CLLocationManager *) manager didEnterRegion:   (CLRegion *) region
{
    NSLog(@"entered  beacon region");
}

- (void) locationManager: (CLLocationManager *) manager didExitRegion: (CLRegion *) region
{
    NSLog(@"exited beacon region");
}

None of these delegate events are called for this beacon region.

I have tested this with geographical regions and it works but it just does not work for my beacon. Also I have tested the ranging on this same beacon which works.

Are there any known issues with beacon monitoring??

Many thanks

ildsarria
  • 281
  • 3
  • 10
  • For the benefit of anyone having this issue, i have found that the plist file has to be updated with a few more attributes in iOS8.2 ( may have been earlier): to the "Required background modes" property add 2 new items: "App shares data using CoreBluetooth" "App registers for location updates” ( this is in addition to already needed properties: NSLocationWhenInUseUsageDescription and/or NSLocationAlwaysUsageDescription – ildsarria Apr 15 '15 at 09:01

1 Answers1

1

Hi @ldsarria Check my steps its working for me

Step 1 : Set delgate in .h file CLLocationManagerDelegate

Step 2:

locationManager = [[CLLocationManager alloc] init];
        locationManager.delegate = self;
        locationManager.desiredAccuracy = kCLLocationAccuracyBest;
        locationManager.distanceFilter = kCLDistanceFilterNone;

Step 3:

NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:@"SOME IDENTIFIER"];
        CLBeaconRegion *region = [[CLBeaconRegion alloc] 
        initWithProximityUUID:uuid identifier:@"com.test.abc"];
                region.notifyEntryStateOnDisplay =YES;
                [locationManager startMonitoringForRegion:region];

Step 4: Set NSLocationAlwaysUsageDescription = "This app needs your location to hunt some treasure."

Cheers!!!

mshau
  • 503
  • 4
  • 19
  • Hi mshau, thank you very much, I had this but the actual problem was two attributes that weree needed in the plist for "Required background modes" property :"App shares data using CoreBluetooth" and "App registers for location updates – ildsarria Apr 15 '15 at 17:36