iOS8 定位问题
来源:互联网 发布:java orm 编辑:程序博客网 时间:2024/06/07 12:01
转:http://blog.csdn.net/chenyong05314/article/details/39925491
在IOS8中定位功能新增了两个方法:
- (void)requestWhenInUseAuthorization __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_8_0);- (void)requestAlwaysAuthorization __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_8_0);
这两个新增的方法导致,之前写的程序在iOS8运行会出现,定位功能无法正常使用
这样让iOS8正常使用定位功能呢?
<1>你需要在info.plist表里面添加两条变量
在Info.plist中加入两个缺省没有的字段
NSLocationAlwaysUsageDescription
NSLocationWhenInUseUsageDescription
这两个字段没什么特别的意思,就是自定义提示用户授权使用地理定位功能时的提示语。
这样在写代码:
CLLocationManager *locationManager = [[CLLocationManager alloc]init]; locationManager.delegate = self; [locationManager requestAlwaysAuthorization]; locationManager.desiredAccuracy = kCLLocationAccuracyBest; locationManager.distanceFilter = kCLDistanceFilterNone; [locationManager startUpdatingLocation];
这是在调用代理
- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status { switch (status) { case kCLAuthorizationStatusNotDetermined: if ([locationManager respondsToSelector:@selector(requestAlwaysAuthorization)]) { [locationManager requestWhenInUseAuthorization]; } break; default: break; }}
这样就Ok了,就会弹出原来的提示框
0 0
- iOS8 定位问题
- iOS8 定位问题
- iOS8 定位失败问题
- iOS8 定位问题
- iOS8 定位问题
- ios8定位问题
- iOS8 定位问题
- ios8 系统定位问题
- iOS8 定位问题
- iOS8 定位问题
- iOS8 地图定位问题
- iOS8 定位问题
- ios8 系统定位问题
- ios8 系统定位问题
- iOS8 定位问题
- iOS8 的定位问题
- iOS8 定位问题
- 定位城市+iOS8 定位问题
- android 之控件篇
- 面向对象的思想
- /bin/bash: prebuilts/misc/linux-x86/bison/bison: No such file or directory
- matlab 实践程序8——将指定的图像移动到另一个文件夹
- OC基础语法
- iOS8 定位问题
- jquery获取当前点击对象
- Barbican 简介
- zookeeper 安装 windows环境
- Windows下C++多线程同步与互斥简单运用
- 引用 电脑快捷键,我一定要运用起来!
- qml 3
- 爱之初体验
- Android学习路线指南