Я использую мониторинг региона в ios 6 и 7. Он работает нормально, если области не перекрываются. Но если некоторые области перекрываются, приложение вызывает метод делегирования didEnterRegion
только для одного региона.Мониторинг перекрывающихся областей
Мой код:
_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__);
}
Это фактически запускает метод делегата: '- (Недействительными) locationManager: (CLLocationManager *) менеджер didDetermineState: (CLRegionState) состояние forRegion: (CLRegion *) region' – Daneo