ios - CLLocationManagerDelegate didFailError 总是回调错误是 CLError 吗?
问题描述
在swift中,CLLocationManagerDelegate
didFailWithError
错误的方法总是CLError?如果是的话,有什么参考吗?
讨论:发生错误时调用。错误类型在“CLError.h”中定义。
这是否意味着我可以LAError
随时将错误转换为?
func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {
guard let error = error as? CLError else {
// Never?
return
}
}
并且LAError
...
解决方案
当 CLLocationManager 对象无法检索位置时,我在下面找到了错误的合法参考。讨论部分在参考中也有一些示例,说明在不同情况下会收到哪些错误:
希望这对你有帮助!!
推荐阅读
- c# - 在 AspNetCore 中显示或隐藏 div 元素
- r - 按 R 中第一组的顺序排列 df 内的所有组
- scala - 完整的 Scala 类参数取决于其类型
- regex - Vim 非贪婪搜索 \{-}
- html - div、标签和按钮中的 css 样式相同,但按钮高度更短
- c# - 无法使用 Mahapp 更改树视图的背景颜色
- reactjs - 如何将从 graphql API 获取的数据传递给 React 类组件
- python - Pythonj json.update
- javascript - 导入后我可以在箭头函数中读取方法吗
- python - 加入具有相同 ID 的行,同时在 python 中保留某些行的一些信息