高德地图SDK(定位)  V2.12.2
AMapLocationManager Class Reference

#import <AMapLocationManager.h>

Inheritance diagram for AMapLocationManager:

Instance Methods

(AMapLocationAccuracyMode) - locationAccuracyMode
 设置定位数据回调精度模式,默认为AMapLocationAccuracyFullAndReduce。
注意:如果定位时未获得定位权限,则首先会调用申请定位权限API,实际定位精度权限取决于用户的权限设置。
Set the positioning data callback accuracy mode, default is AMapLocationAccuracyFullAndReduce.Note: If location permission is not granted during positioning, the system will first call the location permission request API. The actual positioning accuracy depends on the user's permission settings. ————————————————————————————————————————————————————————————————
| 设置选项 | doRequireTemporaryFullAccuracyAuth | 异常/定位数据回调 |
| AMapLocationFullAndReduceAccuracy | 会触发申请临时精确定位回调 | 如果未获得精确定位权限,则依然开启定位,回调模糊定位 |
| AMapLocationFullAccuracy | 会触发申请临时精确定位回调 | 如果未获得精确定位权限,则不开启定位,回调error |
| AMapLocationReduceAccuracy | 不会触发申请临时精确定位回调 | 根据当前定位精度权限,回调定位数据 |
————————————————————————————————————————————————————————————————
当设置AMapLocationFullAndReduceAccuracy时,定位数据回调可通过currentAuthorization判断当前是否是精确定位 ————————————————————————————————————————————————————————————————
| Setting Options | doRequestTemporaryFullAccuracyAuth | Exception/Location Data callback | \ n AMapLayoutFullAndReduceAccuracy | will trigger a temporary precise positioning callback request | If precise positioning permission is not obtained, positioning will still be enabled, and the callback will be fuzzy positioning | \ n | AMapLocationFullAccuracy | It will trigger a temporary precise positioning callback. If precise positioning permission is not obtained, positioning will not be enabled and an error will be called back AMapLocator Reduce Accuracy | Will not trigger a temporary precise positioning callback request | Based on the current positioning accuracy permission, callback positioning data | \ n ————————————————————————————————————————————————————————————————
When setting AMapLocator FullAndReduceAccuracy, the location data callback can determine whether the current location is accurate through the current Authorization More...
 
(CLAccuracyAuthorization) - currentAuthorization
 获取当前定位精度权限。 Obtain the current location accuracy permission. More...
 
(void) - startUpdatingHeading
 开始获取设备朝向,如果设备支持方向识别,则会通过代理回调方法 Start obtaining device orientation. If the device supports orientation recognition, it will be done through a proxy callback method. More...
 
(void) - stopUpdatingHeading
 停止获取设备朝向 Stop getting device orientation More...
 
(void) - dismissHeadingCalibrationDisplay
 停止设备朝向校准显示 Stop device orientation calibration display More...
 
(BOOL) - requestLocationWithReGeocode:completionBlock:
 单次定位。如果当前正在连续定位,调用此方法将会失败,返回NO。
该方法将会根据设定的 desiredAccuracy 去获取定位信息。如果获取的定位信息精确度低于 desiredAccuracy ,将会持续的等待定位信息,直到超时后通过completionBlock返回精度最高的定位信息。
可以通过 stopUpdatingLocation 方法去取消正在进行的单次定位请求。 Single positioning. If the current location is being continuously located, calling this method will fail and return NO. The method will retrieve location information based on the set desiredAccuracy. If the accuracy of the obtained positioning information is lower than the desired accuracy, it will continue to wait for the positioning information until the completion block returns the highest accuracy positioning information after timeout. \The stopUpdatingLocation method can be used to cancel an ongoing single location request. More...
 
(void) - startUpdatingLocation
 开始连续定位。调用此方法会cancel掉所有的单次定位请求。 Start continuous positioning. Calling this method will cancel all single positioning requests. More...
 
(void) - stopUpdatingLocation
 停止连续定位。调用此方法会cancel掉所有的单次定位请求,可以用来取消单次定位。 Stop continuous positioning. Calling this method will cancel all single location requests and can be used to cancel single positioning. More...
 
(void) - startMonitoringForRegion:
 开始监控指定的region。如果已经存在相同identifier的region,则之前的region将会被移除。对 AMapLocationCircleRegion 类实例,将会优先监控radius小的region。 Start monitoring the specified region. If a region with the same identifier already exists, the previous region will be removed.For AMapLocationCircleRegion class instances, the region with a smaller radius will be monitored with priority. More...
 
(void) - stopMonitoringForRegion:
 停止监控指定的region Stop monitoring the specified region More...
 
(void) - requestStateForRegion:
 查询一个region的当前状态。查询结果通过amapLocationManager:didDetermineState:forRegion:回调返回 Query the current state of a region. The query result is returned via the amapLocationManager:didDetermineState:forRegion: callback. More...
 

Class Methods

(BOOL) + headingAvailable
 设备是否支持方向识别 Does the device support direction recognition More...
 
(void) + updatePrivacyShow:privacyInfo:
 更新App是否显示隐私弹窗的状态,隐私弹窗是否包含高德SDK隐私协议内容的状态,注意:必须在AMapLocationManager实例化之前调用. since 2.8.0 Update the status of whether the App displays the privacy pop-up, the status of whether the privacy pop-up contains the content of the AMap SDK privacy agreement, Note: it must be called before AMapLocationManager is instantiated. since 2.8.0 More...
 
(void) + updatePrivacyAgree:
 更新用户授权高德SDK隐私协议状态,注意:必须在AMapLocationManager实例化之前调用. since 2.8.0 Update the user authorization status of AMap SDK privacy policy, note: must be called before AMapLocationManager is instantiated. since 2.8.0 More...
 

Properties

id< AMapLocationManagerDelegate > delegate
 
CLLocationDistance distanceFilter
 
CLLocationAccuracy desiredAccuracy
 
BOOL pausesLocationUpdatesAutomatically
 
BOOL allowsBackgroundLocationUpdates
 
NSInteger locationTimeout
 
NSInteger reGeocodeTimeout
 
BOOL locatingWithReGeocode
 
NSSet * monitoredRegions
 
BOOL detectRiskOfFakeLocation
 

Detailed Description

AMapLocationManager类。初始化之前请设置 AMapServices 中的apikey(例如:[AMapServices sharedServices].apiKey = "您的key"),否则将无法正常使用服务. AMapLocationManager class. Please set the apikey in AMapServices before initialization(For example:[AMapServices sharedServices].apiKey = @"Your key")Otherwise, the service cannot be used normally.

Method Documentation

◆ currentAuthorization

- (CLAccuracyAuthorization) currentAuthorization (ios(14.0)) 

获取当前定位精度权限。 Obtain the current location accuracy permission.

Since
2.6.7

◆ dismissHeadingCalibrationDisplay

- (void) dismissHeadingCalibrationDisplay

停止设备朝向校准显示 Stop device orientation calibration display

◆ headingAvailable

+ (BOOL) headingAvailable

设备是否支持方向识别 Does the device support direction recognition

Returns
YES:设备支持方向识别 ; NO:设备不支持支持方向识别 YES: Device supports orientation recognition; NO: Device does not support orientation recognition

◆ locationAccuracyMode

- (AMapLocationAccuracyMode) locationAccuracyMode (ios(14.0)) 

设置定位数据回调精度模式,默认为AMapLocationAccuracyFullAndReduce。
注意:如果定位时未获得定位权限,则首先会调用申请定位权限API,实际定位精度权限取决于用户的权限设置。
Set the positioning data callback accuracy mode, default is AMapLocationAccuracyFullAndReduce.Note: If location permission is not granted during positioning, the system will first call the location permission request API. The actual positioning accuracy depends on the user's permission settings. ————————————————————————————————————————————————————————————————
| 设置选项 | doRequireTemporaryFullAccuracyAuth | 异常/定位数据回调 |
| AMapLocationFullAndReduceAccuracy | 会触发申请临时精确定位回调 | 如果未获得精确定位权限,则依然开启定位,回调模糊定位 |
| AMapLocationFullAccuracy | 会触发申请临时精确定位回调 | 如果未获得精确定位权限,则不开启定位,回调error |
| AMapLocationReduceAccuracy | 不会触发申请临时精确定位回调 | 根据当前定位精度权限,回调定位数据 |
————————————————————————————————————————————————————————————————
当设置AMapLocationFullAndReduceAccuracy时,定位数据回调可通过currentAuthorization判断当前是否是精确定位 ————————————————————————————————————————————————————————————————
| Setting Options | doRequestTemporaryFullAccuracyAuth | Exception/Location Data callback | \ n AMapLayoutFullAndReduceAccuracy | will trigger a temporary precise positioning callback request | If precise positioning permission is not obtained, positioning will still be enabled, and the callback will be fuzzy positioning | \ n | AMapLocationFullAccuracy | It will trigger a temporary precise positioning callback. If precise positioning permission is not obtained, positioning will not be enabled and an error will be called back AMapLocator Reduce Accuracy | Will not trigger a temporary precise positioning callback request | Based on the current positioning accuracy permission, callback positioning data | \ n ————————————————————————————————————————————————————————————————
When setting AMapLocator FullAndReduceAccuracy, the location data callback can determine whether the current location is accurate through the current Authorization

Since
2.6.7

◆ requestLocationWithReGeocode:completionBlock:

- (BOOL) requestLocationWithReGeocode: (BOOL)  withReGeocode
completionBlock: (AMapLocatingCompletionBlock)  completionBlock 

单次定位。如果当前正在连续定位,调用此方法将会失败,返回NO。
该方法将会根据设定的 desiredAccuracy 去获取定位信息。如果获取的定位信息精确度低于 desiredAccuracy ,将会持续的等待定位信息,直到超时后通过completionBlock返回精度最高的定位信息。
可以通过 stopUpdatingLocation 方法去取消正在进行的单次定位请求。 Single positioning. If the current location is being continuously located, calling this method will fail and return NO. The method will retrieve location information based on the set desiredAccuracy. If the accuracy of the obtained positioning information is lower than the desired accuracy, it will continue to wait for the positioning information until the completion block returns the highest accuracy positioning information after timeout. \The stopUpdatingLocation method can be used to cancel an ongoing single location request.

Parameters
withReGeocode是否带有逆地理信息(获取逆地理信息需要联网) Does it include reverse geocoding information (Internet connection required to obtain reverse geocoding)
completionBlock单次定位完成后的Block Block after single positioning completion
Returns
是否成功添加单次定位Request Was the single location request successfully added?

◆ requestStateForRegion:

- (void) requestStateForRegion: ((deprecated("Please use AMapGeoFenceManager")))  __attribute__

查询一个region的当前状态。查询结果通过amapLocationManager:didDetermineState:forRegion:回调返回 Query the current state of a region. The query result is returned via the amapLocationManager:didDetermineState:forRegion: callback.

Parameters
region要查询的region Region to query

◆ startMonitoringForRegion:

- (void) startMonitoringForRegion: ((deprecated("Please use AMapGeoFenceManager")))  __attribute__

开始监控指定的region。如果已经存在相同identifier的region,则之前的region将会被移除。对 AMapLocationCircleRegion 类实例,将会优先监控radius小的region。 Start monitoring the specified region. If a region with the same identifier already exists, the previous region will be removed.For AMapLocationCircleRegion class instances, the region with a smaller radius will be monitored with priority.

Parameters
region要被监控的范围 Area to be monitored

◆ startUpdatingHeading

- (void) startUpdatingHeading

开始获取设备朝向,如果设备支持方向识别,则会通过代理回调方法 Start obtaining device orientation. If the device supports orientation recognition, it will be done through a proxy callback method.

◆ startUpdatingLocation

- (void) startUpdatingLocation

开始连续定位。调用此方法会cancel掉所有的单次定位请求。 Start continuous positioning. Calling this method will cancel all single positioning requests.

◆ stopMonitoringForRegion:

- (void) stopMonitoringForRegion: ((deprecated("Please use AMapGeoFenceManager")))  __attribute__

停止监控指定的region Stop monitoring the specified region

Parameters
region要停止监控的范围 Area to stop monitoring

◆ stopUpdatingHeading

- (void) stopUpdatingHeading

停止获取设备朝向 Stop getting device orientation

◆ stopUpdatingLocation

- (void) stopUpdatingLocation

停止连续定位。调用此方法会cancel掉所有的单次定位请求,可以用来取消单次定位。 Stop continuous positioning. Calling this method will cancel all single location requests and can be used to cancel single positioning.

◆ updatePrivacyAgree:

+ (void) updatePrivacyAgree: (AMapPrivacyAgreeStatus)  agreeStatus

更新用户授权高德SDK隐私协议状态,注意:必须在AMapLocationManager实例化之前调用. since 2.8.0 Update the user authorization status of AMap SDK privacy policy, note: must be called before AMapLocationManager is instantiated. since 2.8.0

Parameters
agreeStatus用户授权高德SDK隐私协议状态 User authorization status of AutoNavi SDK privacy agreement

◆ updatePrivacyShow:privacyInfo:

+ (void) updatePrivacyShow: (AMapPrivacyShowStatus)  showStatus
privacyInfo: (AMapPrivacyInfoStatus)  containStatus 

更新App是否显示隐私弹窗的状态,隐私弹窗是否包含高德SDK隐私协议内容的状态,注意:必须在AMapLocationManager实例化之前调用. since 2.8.0 Update the status of whether the App displays the privacy pop-up, the status of whether the privacy pop-up contains the content of the AMap SDK privacy agreement, Note: it must be called before AMapLocationManager is instantiated. since 2.8.0

Parameters
showStatus隐私弹窗状态 Privacy pop-up status
containStatus包含高德SDK隐私协议状态 Includes the status of the AutoNavi SDK privacy agreement

Property Documentation

◆ allowsBackgroundLocationUpdates

- (BOOL) allowsBackgroundLocationUpdates
readwritenonatomicassign

是否允许后台定位。默认为NO。只在iOS 9.0及之后起作用。设置为YES的时候必须保证 Background Modes 中的 Location updates 处于选中状态,否则会抛出异常。由于iOS系统限制,需要在定位未开始之前或定位停止之后,修改该属性的值才会有效果。 Whether to allow background location. Default is NO. Takes effect only on iOS 9.0 and later. When set to YES, you must ensure that in Background Modes.Must be in the selected state, otherwise an exception will be thrown. Due to iOS system restrictions, modifying the value of this property will only take effect before positioning starts or after positioning stops.

◆ delegate

- (id<AMapLocationManagerDelegate>) delegate
readwritenonatomicweak

实现了 AMapLocationManagerDelegate 协议的类指针。 A class pointer that implements the AMapLocationManagerDelegate protocol.

◆ desiredAccuracy

- (CLLocationAccuracy) desiredAccuracy
readwritenonatomicassign

设定期望的定位精度。单位米,默认为 kCLLocationAccuracyBest。定位服务会尽可能去获取满足desiredAccuracy的定位结果,但不保证一定会得到满足期望的结果。 Set the desired positioning accuracy. Unit is meters, default is kCLLocationAccuracyBest。 The location service will try its best to obtain location results that meet the desiredAccuracy, but it is not guaranteed that the expected results will definitely be obtained. 注意:设置为kCLLocationAccuracyBest或kCLLocationAccuracyBestForNavigation时,单次定位会在达到locationTimeout设定的时间后,将时间内获取到的最高精度的定位结果返回。 Note: When set to kCLLocator AccuracyBest or kCLLocator AccuracyBestForNavigation, a single localization will return the highest accuracy localization result obtained within the time after reaching the locationTimeout setting. ⚠️ 当iOS14及以上版本,模糊定位权限下可能拿不到设置精度的经纬度

◆ detectRiskOfFakeLocation

- (BOOL) detectRiskOfFakeLocation
readwritenonatomicassign

检测是否存在虚拟定位风险,默认为NO,不检测。
注意:设置为YES时,单次定位通过 AMapLocatingCompletionBlock 的error给出虚拟定位风险提示;连续定位通过 amapLocationManager:didFailWithError: 方法的error给出虚拟定位风险提示。error格式为 error.domain==AMapLocationErrorDomain; error.code==AMapLocationErrorRiskOfFakeLocation;
附带的error的详细信息参考 error.localizedDescription 中的描述以及 error.userInfo 中的信息(error.userInfo.AMapLocationRiskyLocateResult 表示有虚拟风险的定位结果; error.userInfo.AMapLocationAccessoryInfo 表示外接辅助设备信息)。 Detect whether there is a virtual positioning risk, default is NO, do not detect. \Note: When set to YES, a virtual positioning risk warning will be given for a single positioning through the AMapLocator CompletionBlock error; Continuous positioning provides a virtual positioning risk warning through the error of the amapLocationManager: didFailed WithError: method. The error format is error. domain==AMapLocator Error Domain; error.code==AMapLocationErrorRiskOfFakeLocation; \For detailed information on the attached error, please refer to the description in error. localizedDescribe and the information in error. userInfo (where error. userInfo. AMapLocation RiskyLocator Result represents the location result with virtual risk); Error. userInfo. AMapLocator AccessoryInfo represents external auxiliary device information.

◆ distanceFilter

- (CLLocationDistance) distanceFilter
readwritenonatomicassign

设定定位的最小更新距离。单位米,默认为 kCLDistanceFilterNone,表示只要检测到设备位置发生变化就会更新位置信息。 Set the minimum update distance for location. The unit is meters, default is Indicates that the location information will be updated whenever a change in the device's location is detected.

◆ locatingWithReGeocode

- (BOOL) locatingWithReGeocode
readwritenonatomicassign

连续定位是否返回逆地理信息,默认NO。 Whether continuous positioning returns reverse geocoding information, default is NO.

◆ locationTimeout

- (NSInteger) locationTimeout
readwritenonatomicassign

指定单次定位超时时间,默认为10s。最小值是2s。注意单次定位请求前设置。注意: 单次定位超时时间从确定了定位权限(非kCLAuthorizationStatusNotDetermined状态)后开始计算。 Set the timeout for single location, default is 10s. Minimum value is 2s. Note: set before single location request. Note: The timeout for a single location request starts counting after the location permission is determined (not in the kCLAuthorizationStatusNotDetermined state).

◆ monitoredRegions

- (NSSet*) monitoredRegions
readnonatomiccopy

逆地址语言类型,默认是AMapRegionLanguageTypeZhHans Reverse address language type, default is AMapRegionLanguageTypeZhHans 获取被监控的region集合。 Retrieve the set of monitored regions.

◆ pausesLocationUpdatesAutomatically

- (BOOL) pausesLocationUpdatesAutomatically
readwritenonatomicassign

指定定位是否会被系统自动暂停。默认为NO。 On iOS 14 and above, under the approximate location permission, the latitude and longitude with the set accuracy may not be obtained

◆ reGeocodeTimeout

- (NSInteger) reGeocodeTimeout
readwritenonatomicassign

指定单次定位逆地理超时时间,默认为5s。最小值是2s。注意单次定位请求前设置。 Specify the timeout for a single reverse geocoding request, default is 5s. The minimum value is 2s. Note to set before making a single positioning request.


The documentation for this class was generated from the following file:
© 2017 高德信息技术有限公司 版权所有,保留所有权利。