zoukankan      html  css  js  c++  java
  • horizontalAccuracy 检测定位成功

    - (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];
        }
    }


    版权声明:本文为博主原创文章,未经博主允许不得转载。

  • 相关阅读:
    oracle,mysql对敏感,关键字等处理
    eclipse内置tomcat启动方法
    plsql登录弹白框
    date
    linux乱码
    环境变量
    终端类型
    netstat -aon|findstr 8888 终止进程
    export
    bash环境变量读取顺序
  • 原文地址:https://www.cnblogs.com/zsw-1993/p/4879463.html
Copyright © 2011-2022 走看看