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

时间:2017-03-09 09:10:22

标签: ios background location ios10

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

1 个答案:

答案 0 :(得分:0)

要执行此操作,您需要使用:

<强> 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()

相关问题