iOS8定位问题解决方案
2015-08-03 15:23
316 查看
m
info新增键值对如下:
应用程序说明参见微信:
1、修改info
新增Key:NSLocationAlwaysUsageDescription和NSLocationWhenInUseUsageDescription,这两个Key的值将分别用于描述应用程序始终使用和使用期间使用定位的说明,这些说明将显示在用户设置中。info新增键值对如下:
应用程序说明参见微信:
2、CLLocationManager初始化
iOS8CLLocationManager新增实例方法requestWhenInUseAuthorization和requestAlwaysAuthorization,需要在初始化时根据需要调用。
self.locationManage = [[[CLLocationManager alloc] init] autorelease];
self.locationManage.delegate = self;
self.locationManage.distanceFilter = 200;
self.locationManage.desiredAccuracy = kCLLocationAccuracyBestForNavigation;//kCLLocationAccuracyBest;
if (SYSTEM_VERSION >= 8.0) {
//使用期间
[self.locationManage requestWhenInUseAuthorization];
//始终
//or [self.locationManage requestAlwaysAuthorization]
}
3、代理
新增下面的代理方法:- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status { switch (status) { case kCLAuthorizationStatusNotDetermined: if ([self.locationManage respondsToSelector:@selector(requestAlwaysAuthorization)]) { [self.locationManage requestWhenInUseAuthorization]; } break; default: break; } }
相关文章推荐
- iOS9适配系列教程
- ios ScrollerView之图片轮播器
- iOS开发中tableview中cell分隔线与左右的距离
- IOS之GCD记录
- IOS8 ARM64下奇怪的崩溃问题
- 调试iOS 已经发布代码 Crash 文件分析出出错对应代码
- 定制iOS 7中的导航栏和状态栏
- 关于iOS的respondsToSelector等的相关使用小结
- iOS 字符属性NSAttributedString描述
- IOS9使用的SSL/TLS协议运行机制及概述
- iOS开发之在地图上绘制出你运行的轨迹
- iOS开发中tableview中cell图片大小自定义方法
- NSAttributedString的NSUnderlineStyleSingle在iOS8.1上无效的解决方法
- IOS 开发xcode 6.3以后 自制FrameWork教程
- iOS开发中tableview中cell图片自定义方法。
- IOS中几种数据持久化方案,我要永远记住你!
- ios自动布局
- 【IOS】仿QQ侧滑菜单
- iOS高级-QuartzCore框架-CoreAnimation
- IOS第六天(3:scrollView 图片轮播器)