gpt4 book ai didi

ios - StartMonitoringSignificantLocationChanges 方法不返回位置

转载 作者:行者123 更新时间:2023-11-30 13:59:54 25 4
gpt4 key购买 nike

在重大变更位置服务中,我使用了“startMonitoringSignificantLocationChanges”方法,但它仅返回缓存的位置,不返回更新的位置信息。我使用过 Swift 语言。

最佳答案

假设您保留对位置管理器对象的强引用,请确保调用 locationManager.requestAlwaysAuthorization() 以使 startMonitoringSignificantLocationChanges 正常运行。

编辑:

来自Apple Documentation :

Regardless of which location service you use, location data is reported to your app via the location manager’s associated delegate object. Because it can take several seconds to return an initial location, the location manager typically delivers the previously cached location data immediately and then delivers more up-to-date location data as it becomes available. Therefore it is always a good idea to check the timestamp of any location object before taking any actions. If both location services are enabled simultaneously, they deliver events using the same set of delegate methods.

等待一段时间,并确保您进行了物理位置更改,以便位置管理器返回正确的位置。请注意,“重大位置变化”模式总是比常规模式慢。

关于ios - StartMonitoringSignificantLocationChanges 方法不返回位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33119857/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com