下载 zip 文件并将其保存到 iPhone
我想从网络下载 zip 文件,但无法弄清楚我如何
可以下载图像/文本/xml 文件,但无法下载 zip 文件
有人可以指导我如何从网络下载 zip 文件吗?
谢谢
i want to download the zip file from web but unable to figure out that how it is possible
i can download image /text/xml file but unable to download a zip file
Can someone guide me how to download zip files from web?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用 < code>NSURLConnection,无论文件的类型如何,它的工作方式都完全相同。
示例:(凭空想象,不能保证它能以这种方式工作,显然您应该实现错误检查)
然后您必须在委托方法中处理传入的数据,例如仅保存您的数据:
查看其他委托方法并实现它们,您应该处理身份验证挑战和失败响应。例如,您还可以
在
connection:didReceiveResponse:
中设置:并在connectionDidFinishLoading:
中再次将其设置为NO
。If you're using
NSURLConnection
, it works exactly the same way no matter which type the file has.Example: (typed off of my head, no guarantee that it works this way and you should obviously implement error checking)
Then you must handle the incoming data in the delegate methods, e.g. to just save your data:
Take a look at the other delegate methods and implement them, you should deal with authentification challenges and fail responses. You can also for example set:
in
connection:didReceiveResponse:
and set it toNO
again inconnectionDidFinishLoading:
.