iPhone에서 LocationManager를 사용하여 위치 추적 애플리케이션을 개발하고 있습니다. 다음은 나의 질문이다. 사용자가 iphone의 홈 버튼을 클릭하면 응용 프로그램이 백엔드로 전환되었음을 의미합니다. 위치 관리자의 스레드는 계속 작동합니까? 위치 관리자가 현재 위치를 업데이트합니까? 다음은 샘플 코드입니다.LocationManager IOS의 백엔드에서 작동
CLLocationManager *_locationManager;
- (void)startStandardUpdates {
if (nil == locationManager) {
locationManager = [[CLLocationManager alloc] init];
}
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
// Set a movement threshold for new events.
locationManager.distanceFilter = kCLLocationAccuracyNearestTenMeters;
//Will the thread still work even the application is switched to background?
[locationManager startUpdatingLocation];
CLLocation *currentLocation = locationManager.location;
if (currentLocation) {
PAWAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
appDelegate.currentLocation = currentLocation;
}
}
함수 내에서 'printf와'자신이 테스트! – Oliver