2017-04-09 2 views
1

저는 장치의 위도와 경도를 저장해야하는 프로젝트를 진행하고 있습니다. 그러나 장치가 위치에있는 5 ~ 10 미터의 변경을 만들 때이를 저장해야합니다. 나는 약 2 일 동안 googled했다. 그러나 나를 도왔던 아무것도 발견 할 수 없었다. 그래서 intuit/LocationManager 라이브러리를 생각해 냈습니다. 이 라이브러리로 단일 위치를 성공적으로 얻을 수 있습니다. 그러나 내부의 블록 은 장치의 위치가 몇 번 변경되었는지에 관계없이 한 번만 실행됩니다..기기의 위치가 5 미터 또는 10 미터로 변경되면 알림을받는 방법은 무엇입니까?

실제 장치시뮬레이터도 테스트했습니다. 시뮬레이터, 나는 수동으로 같은 위치 변경 : simulate location image

을하지만 큰 변화 업데이트를받지 못했습니다. 여기

내가 지금까지 한 일이다

- (void)startMonitoringSignificantLocationChanges 
{ 
    __weak __typeof(self) weakSelf = self; 
    INTULocationManager *locMgr = [INTULocationManager sharedInstance]; 
    self.locationRequestID = [locMgr subscribeToSignificantLocationChangesWithBlock:^(CLLocation *currentLocation, INTULocationAccuracy achievedAccuracy, INTULocationStatus status) { 
     __typeof(weakSelf) strongSelf = weakSelf; 

     _lastLocation = currentLocation; 

     if (status == INTULocationStatusSuccess) { 
      _significantChangeCount++; 

      // A new updated location is available in currentLocation, and achievedAccuracy indicates how accurate this particular location is 
      strongSelf.changedLatitude.text = [NSString stringWithFormat:@"%f", currentLocation.coordinate.latitude]; 
      strongSelf.changedLongitude.text = [NSString stringWithFormat:@"%f", currentLocation.coordinate.longitude]; 
      strongSelf.changedTime.text = [self getLocaleDateString:currentLocation.timestamp]; 
      if (_significantChangeCount > 0) { 
       strongSelf.changedStatus.text = @"Significant change"; 
      } else { 
       strongSelf.changedStatus.text = @"Monitor started"; 
      } 
     } 
     else { 
      // An error occurred 
      strongSelf.errorLabel.text = [strongSelf getLocationErrorDescription:status]; 
     } 
    }]; 
} 

어떤 도움을 주시면 감사하겠습니다. 아니면이 작업을 수행하는 다른 방법 ??

+0

내 게시물에 2 개 이상의 링크를 추가 할 수 없으므로 코멘트로 추가 : *** 전체 테스트 프로젝트 [여기] (https://drive.google.com/file/d)를 업로드했습니다./0Bzxb70Gwq7HWMkVDNkp2WGVUcTg/view? usp = sharing) ***. 어떤 도움 ?? – Bixby

답변

0

5 ~ 10 미터의 움직임이 위치에 "중요한"변화로 계산하지 않습니다 : 장치가 이전 통지에서 500m 이상을 이동할 때

앱은 즉시 알림을 기대할 수 있습니다. 5 분마다 한 번만 알림을 보내야합니다.

(source)

당신이 5-10 미터 규모의 변화를 모니터링해야하는 경우에는 다른 방법을 사용해야합니다.

+0

다른 접근법을 제안 해 주시겠습니까? 나는이 위치 서비스에 대해 새로운 사람이다. – Bixby

관련 문제