gpt4 book ai didi

ios - 终止应用程序后我没有获取用户当前的运行位置

转载 作者:行者123 更新时间:2023-11-30 12:04:55 24 4
gpt4 key购买 nike

当应用程序处于终止后台模式时,我需要用户运行位置和路线图路径。

目前我正在使用重要位置进行应用程序终止模式,但我们没有获得正确的距离和路线。因为 didUpdateLocations 在某个特定的时间间隔后被调用,所以我没有获得正确的距离。请指导。

最佳答案

根据苹果文档:

Apps can expect a notification as soon as the device moves 500 meters or more from its previous notification. It should not expect notifications more frequently than once every five minutes. If the device is able to retrieve data from the network, the location manager is much more likely to deliver notifications in a timely manner.

这就是为什么 startMonitoringSignificantLocationChanges() 无法可靠地跟踪驾驶/公共(public)交通以外的用户位置变化。

现在,回到应用程序终止时必须跟踪用户位置的问题,不幸的是,您无法在应用程序终止时跟踪位置

If your app is terminated either by a user or by the system, the system doesn’t automatically restart your app when new location updates arrive. A user must explicitly relaunch your app before the delivery of location updates resumes. The only way to have your app relaunched automatically is to use region monitoring or the significant-change location service.

关于ios - 终止应用程序后我没有获取用户当前的运行位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46784621/

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