gpt4 book ai didi

应用程序终止时的 iOS 10 更新位置

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:31:36 25 4
gpt4 key购买 nike

我正在制作一个应用程序,用于显示用户与其他用户的距离。我可以在应用程序打开时和应用程序处于后台时更新用户位置但是我不知道如何在应用程序终止时更新位置。有人告诉我这是不可能的,但我相信这是可能的,因为 Life 360​​、Facebook 等更新了处于终止状态的位置。非常感谢任何有关如何实现这一目标的帮助!

最佳答案

为此你需要使用:

myLocationManager.startMonitoringSignificantLocationChanges()

来自文档:

"If you start this service and your app is subsequently terminated, the system automatically relaunches the app into the background if a new event arrives."

不幸的是,从广泛的测试来看,重大变化开始出现时非常不准确,因此您可能希望在后台收到重大位置变化时打开正常位置更新。

myLocationManager.startUpdatingLocation()

关于应用程序终止时的 iOS 10 更新位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42691102/

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