현재 다른 개발자가 시작한 iOS 앱에서 작업하고 있습니다. 앱은 낮은 정밀도 (100 미터)로 사용자 위치를 알아야하기 때문에 위치 변경을 모니터링해야합니다. 위치 정보 항목의 이전 구현은 NSTimer
및 startUpdatingLocation
을 사용하여 수행되었습니다. 실행은 다음과 같이 진행됩니다NSTimer로 startMonitoringSignificantLocationChanges를 사용하여 배터리 사용 개선하기
// Fire each 10 seconds start updating location
self.timerPosition = [NSTimer scheduledTimerWithTimeInterval:ti
target:self
selector:@selector(location)
userInfo:nil
repeats:YES];
[self.timerPosition fire];
위치 선택이
// Configure & check location services enabled
...
self.locman.delegate = self;
self.locman.desiredAccuracy = kCLLocationAccuracyHundredMeters;
[self.locman startUpdatingLocation];
그리고 수행 한 후 위치 관리자 위임
[manager stopUpdatingLocation];
그러나 애플 문서에 사용자 위치를 얻기에 관하여 읽기, 그것을에서 저전력 소비로 위치를 파악하는 올바른 방법은 startMonitoringSignificantLocationChanges
을 사용하는 것입니다.
제 질문은 startUpdatingLocation
대신 startMonitoringSignificantLocationChanges
과 결합하여 위치 타이머를 유지하는 것이 좋습니까? 아니면 말도 안되는 방법입니까?
앱이 백그라운드에있을 때 위치 정보를 가져올 필요는 없지만 앱이 활성화되었을 때 사용자가 위치를 변경 한 시점을 알고 싶습니다.
넌센스 접근법입니다. importantLocationChanges 또는 RegionMonitoring 서비스를 사용해야합니다. 배경 지원이 필요하지 않으면 중요한 위치 변경이 더 나은 접근 방법이라고 생각합니다 – Lefteris