1

iOS在其方法 CLLocationManager中报告各种错误: https ://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CoreLocationConstantsRef/Reference/reference.html#//apple_ref/c/econst/kCLErrorDenieddidFailWithError

在文档中不清楚这些错误中的哪一个(除了kCLErrorDeniedkCLErrorLocationUnknown)会停止位置管理器和位置更新?

问候,

4

2 回答 2

0

尝试打印您的错误对象描述。你会知道失败的原因是什么。可能的原因可能是您没有授予应用使用位置的权限,或者手动撤销了使用位置的权限。

如果您在模拟器中失败,请确保模拟器指向某个自定义位置。

于 2014-02-20T06:35:12.667 回答
0

以我的经验,这些错误不会停止位置管理器。但是,您可能需要使用该功能来处理授权中可能发生的变化

func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {
    // here you call the function where you manage the location authorizations at the launch of the app
}
 
于 2022-02-12T18:28:53.713 回答