• ios如何获取位置权限


     获取当前位置需要改plist文件  在plist文件加入   NSLocationWhenInUseUsageDescription  字段 

      /**

         初始化一个管理器对象

         */

        locationManager = [[CLLocationManager alloc] init];

        /**

         *  设置代理

         */

        locationManager.delegate = self;

        locationManager.desiredAccuracy = kCLLocationAccuracyBest;

        /**

         *  设置移动多远来获取一次请求

         */

        locationManager.distanceFilter = 1000.0f;

        

        /**

         *  判断版本

         *

         *  @param requestWhenInUseAuthorization

         *

         *  @return ios7以上需要写此方法来获取当前位置

         */

        if ([locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) {

            

            [locationManager requestWhenInUseAuthorization];

        }

        

        /**

         *  开始获取当前位置

         */

        [locationManager startUpdatingLocation];

        

  • 相关阅读:
    Pthon3各平台的安装
    scrapy爬虫 简单入门
    自动定时打卡7.13
    centos7+python3+selenium+chrome
    在Ubuntu安装kubernetes
    在Ubuntu下安装Jenkins
    在Ubuntu安装Docker
    猫眼100 爬虫
    python 招聘数据分析
    mysql8.0.19忘记密码
  • 原文地址:https://www.cnblogs.com/yevgeni/p/5579192.html
Copyright © 2020-2023  润新知