3
내 iPhone 앱에서 지리적 위치 정보를 사용하고 있습니다. 몇 초 동안 지리적 위치를 사용했거나 앱이 백그라운드에 있어도 배터리가 빨리 소모됩니다.iOS : 지리적 위치가 아직 켜져 있는지 확인하는 방법은 무엇인가요?
내 iPhone 장치에서 지리적 위치 서비스가 계속 켜져 있는지 어떻게 확인할 수 있습니까? 이것은 내가 사용했던 코드 :
...
locationManager = [[CLLocationManager alloc] init]; // Create new instance of locMgr
locationManager.delegate = self;
locationManager.distanceFilter = kCLDistanceFilterNone;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[locationManager startUpdatingLocation];
NSLog(@"locationManager startUpdatingLocation");
reverseGeocoder = [[MKReverseGeocoder alloc] initWithCoordinate:locationManager.location.coordinate];
reverseGeocoder.delegate = self;
[reverseGeocoder start];
}
...
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
}
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error
{
NSLog(@"reverseGeocoder failed: %@", [error localizedDescription]);
}
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark
{
NSLog(@"locality %@", placemark.locality);
location = [placemark.locality retain];
}