iOS 定位相关问题

来源:互联网 发布:热设计软件 编辑:程序博客网 时间:2024/05/01 11:03

一、授权问题

自iOS8起,系统定位功能升级,

二、定位功能

由于系统原因,iOS不允许使用第三方定位,因此地图SDK中的定位方法,本质上是对原生定位的二次封装。通过封装,开发者可更便捷的使用。此外,地图SDK中还提供了相应的定位图层(支持定位三态效果),帮助开发者显示当前位置信息。

三、相关代理(CLLocationManagerDelegate)方法

  1. Responding to Authorization Changes(对授权的变化)
//代理方法名称:- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status;

官方描述:Tells the delegate that the authorization status for the application changed.(告诉委托 授权应用程序的状态发生改变。)This method is called whenever the application’s ability to use location services changes. (无论应用程序什么时候调用定位服务或者获取什么权限,这个方法都会被调用,因为用户随时都可能会更改应用程序的权限。如果应用程序已经从 requestWhenInUseAuthorization方法 或者 requestAlwaysAuthorization方法获取到授权状态,那么locationManager 就不会报告授权状态给这个方法,locationManager 只报告更改授权状态)
2. xx
3. sss

0 0