后台运行时,位置更新在17-18分钟后停止

3

在完美运行了17-18分钟后,didUpdateLocations方法不再在后台调用。我已经检查了位置更新选项,使应用程序在后台运行。应用程序运行了15-20分钟,然后didUpdateLocation在后台停止调用。

请帮忙解决问题。


5
我找到了解决方法,我们需要将pausesLocationUpdatesAutomatically属性设置为NO。 - Peter H
1个回答

3

感谢发布解决方案。在Swift 3中,我将pausesLocationUpdatesAutomatically设置为false,似乎效果非常好。

    let manager = CLLocationManager()
    manager.desiredAccuracy = kCLLocationAccuracyBest
    manager.delegate = self
    manager.requestWhenInUseAuthorization()
    manager.allowsBackgroundLocationUpdates = true
    manager.pausesLocationUpdatesAutomatically = false

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接