[英]How to pause/resume downloads in iPhone (iOS)
I have to download large amount of data (anywhere between 300MB - 1GB ). 我必须下载大量数据( 300MB到1GB之间)。
I am currently using **NSURLConnection**
to download the data. 我目前正在使用**NSURLConnection**
来下载数据。 But, now i am looking at a scenario where the user might loose the internet connection during the download process. 但是,现在我正在研究用户在下载过程中可能会丢失互联网连接的情况。 Currently i am restarting the entire download process in this scenario, which i think is a very bad way of downloading and a waste of user bandwidth. 目前我正在重新启动这个场景中的整个下载过程,我认为这是一种非常糟糕的下载方式和浪费用户带宽。
Is there a process in which i can manage the downloads with Pause/Resume functionality while downloading . 是否有一个过程可以在下载时使用暂停/恢复功能管理下载 。
Here's a tutorial of how to do this on IOS. 这是一个如何在IOS上执行此操作的教程 。
Also check documentation . 还要检查文档 。 This will require your server to support range headers. 这将要求您的服务器支持范围标头。
this needs synchronization both at server as well as client side. 这需要在服务器和客户端同步。 and i allready told u to use chunks. 我已经告诉你要用块了。 definetely chunks is the only solution if you want to pause. 如果你想暂停,definetely chunks是唯一的解决方案。 you will send the server with a chunk id to stop till this i'll get remaing next and next time you will ask from that id. 你将发送一个带有块ID的服务器停止,直到我将在下一次重新下载,下次你将从该id询问。
您可以使用“NSURLSession暂停和恢复
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.