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

标签 ios background location ios10

我正在制作一个应用程序,用于显示用户与其他用户的距离。我可以在应用程序打开时和应用程序处于后台时更新用户位置但是我不知道如何在应用程序终止时更新位置。有人告诉我这是不可能的,但我相信这是可能的,因为 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/

相关文章:

ios - 表格 View 单元格仅在屏幕外时自动布局

ios - 如何在 iOS 中修复 "NSURLErrorDomain error code -999"

android - 使用纬度和经度信息创建 Google 位置 URL

ios - 通知 Swift3 的 removeObserver

ios - 如何将一大堆整数从 ObjC 传递给 JS?

css - 多个相同的 RGBA 颜色不起作用

Android 小部件背景透明度

ruby-on-rails - 保持 rake 作业运行

security - Windows Azure 地理位置

java - 谷歌地图 GPS : longitude and latitude returns zero