简体   繁体   English

NSURLSessionDownloadTasks在设备自动锁定或30分钟后台活动后停止

[英]NSURLSessionDownloadTasks halt after device auto-lock or 30 minutes of backgrounded activity

I am developing a downloader app for a client, and need to be able to background download tasks for very large fiels (ex, 3GB). 我正在为客户开发一个下载器应用程序,并且需要能够为非常大的fiels(例如,3GB)进行后台下载任务。 I am using a background-configured NSURLSession and NSURLSessionDownloadTasks . 我正在使用后台配置的NSURLSessionNSURLSessionDownloadTasks It is working great, except I often notice that the downloads will halt (stop reporting progress, never complete), when the device auto-locks, or after 30 minutes of being backgrounded. 它工作得很好,除了我经常注意到下载将停止(停止报告进度,永远不会完成),设备自动锁定时,或者在后台运行30分钟后。

Is anyone else seeing this issue, or aware of any limitations with background-enabled NSURLSession ? 是否有其他人看到此问题,或意识到启用了后台的NSURLSession有任何限制?

Thanks 谢谢

There are strict guidelines on apps operating in the background. 有关在后台运行的应用程序的严格指导。 You should read through this documentation: https://developer.apple.com/library/ios/documentation/iphone/conceptual/iphoneosprogrammingguide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html#//apple_ref/doc/uid/TP40007072-CH4-SW3 您应该阅读以下文档: https//developer.apple.com/library/ios/documentation/iphone/conceptual/iphoneosprogrammingguide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html#//apple_ref/doc/uid/TP40007072-CH4-SW3

There are only certain classes of apps that are allowed to operate for extended periods of time in the background: VoIP and Location-Based Applications are the only ones that can operate for periods of time you are suggesting. 只有某些类别的应用程序可以在后台长时间运行:VoIP和基于位置的应用程序是唯一可以在您建议的时间段内运行的应用程序。 This is due to considerations like battery life, etc. 这是由于电池寿命等因素。

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

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