Monitoring overlapping regions

Viewed 423

I use region monitoring in ios 6 and 7. It works fine, if regions are not overlapping. But if some regions are overlapping then the app calls delegate method didEnterRegion only for one region.

My code:

_locationManager = [[CLLocationManager alloc] init];
_locationManager.delegate = self;

for (XPLocationModel* locationModel in models) {
 if ([self.locationManager respondsToSelector:@selector(startMonitoringForRegion:)]) {
    [self.locationManager startMonitoringForRegion:locationModel.region];
} else if ([self.locationManager respondsToSelector:@selector(startMonitoringForRegion:desiredAccuracy:)]) {
    [self.locationManager startMonitoringForRegion:locationModel.region desiredAccuracy:XPGeofenceMaster_DesiredAccuracy];
}
}

- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region {
   NSLog(@"%s id == %@", __PRETTY_FUNCTION__, region.identifier);
}

- (void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region {
   NSLog(@"%s", __PRETTY_FUNCTION__);
}
1 Answers
Related