简体   繁体   English

从iOS下载具有恢复功能的大文件(1 + Gb)

[英]Download a large file (1+Gb) from iOS with resume capability

Here is the point: I've got an app that runs with a set of images in very low resolution. 重点是:我有一个应用程序,它以非常低的分辨率运行一组图像。 Nothing special here. 这里没什么特别的。

When the app starts, I'd like it starts the synch download of full resolution photos set process (photos are downloaded off a remote server). 应用启动时,我希望它开始同步下载全分辨率照片设置过程(照片是从远程服务器下载的)。 As the file is typically large (>1Gb), I need a way to resume from a potential stop (whatever the reasons), so that it eventually have 100% of photo set on the device without having to start over from the start. 由于文件通常很大(> 1Gb),因此我需要一种从可能的停止位置恢复播放的方法(无论何种原因),以便最终在设备上设置100%的照片,而不必从头开始。

How would you do that? 你会怎么做?

Your question does not tells about the data in details. 您的问题没有详细说明数据。 There are 2 cases possible : 有两种情况:

  1. You are downloading all the images as a single file(like .zip) or in a single request : In this case you can use NSURLSession which has the pause and resume facility inbuilt. 您将所有图像下载为单个文件(例如.zip)或单个请求 :在这种情况下,您可以使用具有内置的暂停和恢复功能的NSURLSession
  2. You are downloading the images one by one : In this case you need to have track of the images with some id or index to start the download from a particular file in a sequential manner. 您正在一张一张地下载图像 :在这种情况下,您需要跟踪带有一些ID或索引的图像,以便按顺序从特定文件开始下载。 For each file pause and resume facility you can use NSURLSession . 对于每个文件暂停和恢复功能,您可以使用NSURLSession

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

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