[英]IOS: Which is the best way to download a Large size file from server
I have a zip file which contains db. 我有一个包含db的zip文件 。 i need to download that zip file when the user open the app at first time.So am using 用户第一次打开应用程序时,我需要下载该zip文件。
NSData *urlData =[NSData dataWithContentsOfURL:urlToRequest];
to download a file in GCD mode. 以GCD模式下载文件。 Since it's working fine,am not getting any errors. 既然工作正常,就不会出现任何错误。
But, is it ok to download a large File using the above method or we have to use NSURLConnection
for large file download. 但是,可以使用上述方法下载大型文件NSURLConnection
还是必须使用NSURLConnection
进行大型文件下载。 Please advice. 请指教。
You should use NSURLSession => NSURLSessionDownloadTask api 您应该使用NSURLSession => NSURLSessionDownloadTask api
What is wrong with below for large file download 大文件下载下面有什么问题
[NSData dataWithContentsOfURL:urlToRequest];
Now, NSURLSession => NSURLSessionDownloadTask supports all of the above. 现在,NSURLSession => NSURLSessionDownloadTask支持上述所有功能。
Follow this nice tutorial: 遵循这个不错的教程:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.