简体   繁体   English

如何在后台保持 iOS 应用程序存活超过 10 分钟?

[英]How to keep iOS app alive while in background, longer than 10 minutes?

I found this tutorial https://www.raywenderlich.com/5247-core-location-tutorial-for-ios-tracking-visited-locations (you can download the sample project and play with it.) which will track you by giving you long/lat, even if the app is closed or backgrounded, it will continue to give you the lat/long.我找到了本教程https://www.raywenderlich.com/5247-core-location-tutorial-for-ios-tracking-visited-locations (您可以下载示例项目并使用它。)它将通过提供跟踪您你的纬度/纬度,即使应用程序关闭或后台运行,它也会继续为你提供纬度/经度。 However, if the app is backgrounded, and I leave the phone alone for about 10 minutes, the app seems to go into some kind of "suspend" state, in which when I pick it up again, the app no longer track you (no lat/long) until you bring the app to the foreground(you can now see the UI), then it will resume tracking.但是,如果应用程序在后台运行,并且我将手机搁置约 10 分钟,应用程序似乎 go 进入某种“暂停”state,其中当我再次拿起它时,应用程序不再跟踪您(没有纬度/经度),直到您将应用程序带到前台(您现在可以看到 UI),然后它将恢复跟踪。 But I want this app to continue tracking, while in the background indefinitely.但我希望这个应用程序在无限期地在后台继续跟踪。 I don't want it to go into a suspend mode.我不想让它 go 进入挂起模式。

For testing purposes, I made the code:出于测试目的,我编写了代码:

   locationManager.distanceFilter = 3 // give me lat/long every 3 meters

I tried a lot of things to get this to work, for example, I created a recursive function that will run indefinitely, just to keep the app alive.我尝试了很多方法来让它工作,例如,我创建了一个递归 function 将无限期地运行,只是为了让应用程序保持活力。 But it did not work但它没有用

When application enters the "Background" state - you code still running, but after several minutes app move to "Suspended" state and system can kill application for free memory, in this state you code doesn't work When application enters the "Background" state - you code still running, but after several minutes app move to "Suspended" state and system can kill application for free memory, in this state you code doesn't work

计划

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

相关问题 超过10分钟的后台iOS App和与Web Service的通信 - iOS App in background longer than 10 minutes and communicating with Web Service 如何让您的 iOS 应用程序在后台运行超过 3 分钟? - How to get your iOS app to run in the background for longer than 3 minutes? 当应用程序在后台时,如何在IOS应用程序中保持XMPP连接活动? - How to keep XMPP connection alive in the IOS App when app in background? iOS 应用程序如何在后台保持 TCP 连接无限期活动? - How can an iOS app keep a TCP connection alive indefinitely while in the background? 在后台运行iOS App超过10分钟 - Running iOS App in background for more than 10 minutes 如何在后台保持iphone ios websocket连接的活动状态? - How to keep iphone ios websocket connection alive while in the background? 如何在后台保持iphone ios xmpp连接活着? - How to keep iphone ios xmpp connection alive while in the background? iOS应用评论 - 视频流MPEG-DASH超过10分钟 - iOS app review - Video streaming MPEG-DASH for longer than 10 minutes 在后台运行应用程序超过 10 分钟 - Run app for more than 10 minutes in background 如何在iOS的后台模式下保持Alive PJSIP的生命 - How to keep Alive PJSIP alive in background mode for iOS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM