简体   繁体   English

iOS 后台定位应用程序在 15 或 17 小时后自动终止

[英]iOS background location app terminated automatically after 15 or 17 hours later

I built my gps location app working on background mode.我构建了在后台模式下工作的 GPS 定位应用程序。 But it was terminated after 15 or 17 hours later when the app entered background mode.但是当应用程序进入后台模式时,它在 15 或 17 小时后被终止。 Here is my code.这是我的代码。

locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters
locationManager.startUpdatingLocation()
locationManager.allowsBackgroundLocationUpdates = true
locationManager.pausesLocationUpdatesAutomatically = false

This is capability image of my app.这是我的应用程序的功能图像。

If you are monitoring with the accuracy set to nearest 10 meters, the user can manually quit your app or the system can terminate you in the background for any reason (eg reclaiming RAM) and you will no longer receive updates until you relaunch.如果您以最接近 10 米的精度进行监控,用户可以手动退出您的应用程序,或者系统可以出于任何原因(例如回收 RAM)在后台终止您,并且您将不会再收到更新,直到您重新启动。 iOS will not relaunch you in the background when resources are available;当资源可用时,iOS 不会在后台重新启动您; your user has to do it explicitly.您的用户必须明确地这样做。

If you use significant change or region monitoring (like geofencing) events, you can be relaunched in the background by the system unless your users turn it off but this will obviously not guarantee an update every 10 meters.如果您使用重大更改区域监控(如地理围栏)事件,系统可以在后台重新启动您,除非您的用户将其关闭,但这显然不能保证每 10 米更新一次。

There is no specific promise as to how long you can run in the background or that you will not be terminated by the system for reasons completely out of your control.对于您可以在后台运行多长时间,或者您不会因完全无法控制的原因被系统终止,没有具体的承诺。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM