下载大文件这需要10分钟以上时,iPad设备被锁定 [英] Download large files which takes more than 10 min when iPad device is locked

查看:221
本文介绍了下载大文件这需要10分钟以上时,iPad设备被锁定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要求,在这里用户可以下载多个文件另一个之后。
当我的应用程序中去背景或iPad的时候被锁定,下载或Web服务响应能够得到的只有10分钟。

I have a requirement where user can download multiple files one after other. When my app goes in background OR when iPad is locked, the download or web-service response can be get only for 10 minutes.

我的下载发生在一个单独的线程,我已实施 beginBackgroundTaskWithExpirationHandler:后,一些谷歌上搜索和链接计算器

My download happens in a separate thread, I have implemented beginBackgroundTaskWithExpirationHandler: after some googling and on stackoverflow links.

如何实现任务完成

应用程序崩溃,因为在iPhone自动锁定的?

和iOS的documetation

and iOS documetation

<一个href=\"https://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html\" rel=\"nofollow\">https://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html

现在我的一些选定的文件被下载,有些失败,因为一次只能10分钟,最大运行后台任务。

Now some of my selected files are downloaded and some failed because one can run background task only for 10 min max.

对此有任何替代?
我应该彻底暂停下载应用程序的同时在云后台?
谁能帮我对此??

Is there any alternative for this?? Should I pause download completely while app goes in background?? Can anyone help me regarding this??

我已经成功地做​​到这一点,如果通过我的下载过程中没有结束后台任务

I have succeeded to do so by not ending background task if my download is in progress

bgTask = [应用beginBackgroundTaskWithExpirationHandler:^ {
            的NSLog(@\\ n beginBackgroundTaskWithExpirationHandler称为\\ n);
            如果(![个体经营checkIfDownloadInProgress]){
                [个体经营endTaskOnCompletion]
            }
        }];

这如果设备由用户手动锁定才有效。如果设备锁定后自动2分钟,应用程式10分钟运行,然后将其坠毁
任何人可以帮助?

This works only if device is manually locked by user. If device locks automatically after 2 min, app runs for 10 min and then it is crashed Can anybody help?

推荐答案

只有这样,我发现这是可能的:

Only way I found this is possible:


  1. 使用断点续传传输,下载/以块的形式上传。

  2. 当应用程序发送到后台继续,10分钟转移

  3. 清理时,时间到了

  4. 当应用程序被激活履历转会

此文件pretty多总结网络和多任务处理可能的解决方案:
https://developer.apple.com/library/ios/#technotes /tn2277/_index.html

This document pretty much summarizes possible solutions in Networking And Multitasking: https://developer.apple.com/library/ios/#technotes/tn2277/_index.html

这篇关于下载大文件这需要10分钟以上时,iPad设备被锁定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆