time 2015-03-19 18:30:59 Turing community
Since iOS does not have direct control over GPS, we generally use Cllocationmanager to obtain geolocation information and we use
kCLLocationAccuracyBest;
To request the most accurate geo-location information. But there was a time when the geographic information requested was very biased.
It is not the problem of error, it is the problem that can not be used completely. CLLocation
there is actually an horizontalAccuracy
attribute that we can use to control the accuracy problem. For example, we require a precision of 200 meters, we can write:
- (void) Locationmanager: (Cllocationmanager *) Lmanager didupdatetolocation: (cllocation *) newlocation fromLocation: ( Cllocation *) oldlocation{ if (newlocation. Horizontalaccuracy < 200 && newlocation.horizontalaccuracy! =-1" { //many many code Here...} else { [Lmanager stopupdatinglocation]; span class= "comment" >//stop getting [Nsthread Sleepfortimeinterval:10"; //blocked 10 seconds [Lmanager Startupdatinglocation];//retrieve }
CLLocation
The horizontalAccuracy
attribute accuracy is meters, when the value is 1, the position is not trusted, so we can filter out the non-conforming data in this way, and ask for geo-location information.
IOS positioning accuracy