【问题标题】:iOS 10 update location when app is terminated应用程序终止时iOS 10更新位置
【发布时间】:2017-07-30 04:30:28
【问题描述】:

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

【问题讨论】:

    标签: ios background location ios10


    【解决方案1】:

    为此,您需要使用:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-06
      • 1970-01-01
      • 2016-04-07
      • 2015-05-01
      • 1970-01-01
      • 2023-03-11
      • 1970-01-01
      • 2016-09-23
      相关资源
      最近更新 更多