URLCache - iPhone SDK
我需要一些帮助来使用 NSURLCache 下载一个简单的文件。它需要保存在应用程序的文档文件夹中。我已经看过苹果提供的 URLCache 示例,但我发现它没有用,因为它显示的是图像。另外修改日期上还有一些复杂的代码。我实际上需要一些东西,当应用程序打开时它将开始下载过程。有人可以指导我完成任何文件的下载过程吗?
谢谢
凯文
I need some help in using the NSURLCache to download a simple file. It would need to be saved in the Documents folder of the app. I have seen the URLCache example that apple presented, but I didn't find it useful since it was an image that was being shown. In addition there was some complex code on the modification date. I actually need something when the application opens it will begin the download process. Can someone guide me through just the download process of any file?
Thanks
Kevin
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这会阻塞,但对于小量下载来说应该没问题。如果您要下载很多兆字节的内容,请考虑异步下载。您可以在此处查看示例:
http://github.com/erica/iphone-3.0-cookbook-/tree/master/C13-Networking/07-Asynchronous%20Downloads/
This will block, but should be ok for small downloads. If you are going to be downloading something that is many megabytes then look into asynchronous downloads. You can see an example here:
http://github.com/erica/iphone-3.0-cookbook-/tree/master/C13-Networking/07-Asynchronous%20Downloads/