ios8 gps定位不好用

这样让iOS8正常使用定位功能呢?

<1>你需要在info.plist表里面添加两条变量

 

在Info.plist中加入两个缺省没有的字段

  • NSLocationAlwaysUsageDescription

  • NSLocationWhenInUseUsageDescription

这两个字段没什么特别的意思,就是自定义提示用户授权使用地理定位功能时的提示语。

 

locationManager = [[CLLocationManager alloc]init];

    locationManager.delegate = self;

    locationManager.desiredAccuracy = kCLLocationAccuracyBest;

    locationManager.distanceFilter = 1000.f;

    

    if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) {

        [locationManager requestAlwaysAuthorization];

    }

    

posted on 2016-01-07 15:16  Hai_阔天空  阅读(228)  评论(0编辑  收藏  举报

导航