我有一个应用程序,它具有与startUpdatingLocation一起运行的位置管理器。但是,如果它没有移动的话,我stopUpdatingLocation,标记当前位置为区域和startMonitoringForRegion像这样:locationManager:didExitRegion:应用程序运行时未调用
[locationManager stopUpdatingLocation];
CLRegion* region = [[CLRegion alloc] initCircularRegionWithCenter:self.currentLocation.coordinate radius:25 identifier:@"last_loc"];
[self.locationManager startMonitoringForRegion:region desiredAccuracy:kCLLocationAccuracyNearestTenMeters];
[region release];
当应用程序被完全关闭,我退出该地区,的LocationManager:didExitRegion被调用,我继续我的快乐的方式,像这样:
- (void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region
{
[self.locationManager stopMonitoringForRegion:region];
[locationManager startUpdatingLocation];
}
但是,如果应用程序正在运行,无论是在背景或前景,应用程序将不响应的LocationManager:didExitRegion。我错过了什么?
你在iPhone 4硬件上测试吗?只有iPhone 4硬件支持区域跟踪。 – timthetoolman 2011-06-02 01:55:40
@timthetoolman,是的,iPhone 4. – 2011-06-02 02:31:55
你是否设置了位置管理器的代表? – timthetoolman 2011-06-02 03:14:28