【发布时间】:2014-01-13 06:14:22
【问题描述】:
我在 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__);
}
【问题讨论】:
标签: ios objective-c geolocation location