horizontalAccuracy 检测定位成功

来源:互联网 发布:图论 教材 知乎 编辑:程序博客网 时间:2024/06/14 07:15

- (void)findCurrentLocation {    self.isFirstUpdate = YES;    [self.locationManager startUpdatingLocation];}- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations {    if (self.isFirstUpdate) {        self.isFirstUpdate = NO;        return;    }        CLLocation *location = [locations lastObject];        /*当定位成功后,如果horizontalAccuracy大于0,说明定位有效     horizontalAccuracy,该位置的纬度和经度确定的圆的中心,并且这个值表示圆的半径。负值表示该位置的纬度和经度是无效的。     */    if (location.horizontalAccuracy > 0) {        self.currentLocation = location;        [self.locationManager stopUpdatingLocation];    }}


0 0
原创粉丝点击