Trying to start MapKit location updates without prompting for location authorization. Must call -[CL
来源:互联网 发布:电脑管家的数据恢复 编辑:程序博客网 时间:2024/06/05 03:28
(2)对于Trying to start MapKit location updates without prompting for location authorization. Must call -[CLLocationManager requestWhenInUseAuthorization] or -[CLLocationManager requestAlwaysAuthorization] first.问题
在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
- Trying to start MapKit location updates without prompting for location authorization. Must call -[CL
- 运行出现:Trying to start MapKit location updates without prompting for location authorization.
- Xcode6下iOS8地图无法定位问题Trying to start MapKit location updates without prompting for location authorizat
- Core Location,MapKit 和Geofengcing
- IOS的后台任务之: location updates
- firefox permission denied to call method Location.toString 错误
- Core Location定位和MapKit视图使用
- Location
- location
- Location
- location
- Location
- Location
- location
- location
- location
- iOS 8 Location Authorization 的新变更
- Setting for storage location
- Django “no such table: django_session”的解决办法
- DRL前沿之:Benchmarking Deep Reinforcement Learning for Continuous Control
- QT5添加资源文件以及设置背景
- USES_CONVERSION的使用和注意
- js对cookie的操作
- Trying to start MapKit location updates without prompting for location authorization. Must call -[CL
- Kernel 心路历程 万事开头难
- 【多媒体封装格式详解】---MKV【1】
- 概率论与数理统计(第一章 概率论的基本概念)
- oc/c/c++混编老文,写的很好,mark
- iOS label根据显示内容自适应大小
- HTTP网络连接相关知识整理(三):网络错误异常
- Android适配器Adapter学习
- CC2541之OAD