iPhone:在运行时下载zip并在主bundle子目录中解压缩 [英] iPhone: Downloading zip and extracting in main bundle subdirectory at runtime

查看:150
本文介绍了iPhone:在运行时下载zip并在主bundle子目录中解压缩的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想扩展我的iPhone应用程序,应用程序将一个zip文件下载到
a子目录,然后提取它,然后加载zip内的图像。

I want to extend my iPhone app that the app downloads a zip file into a sub directory then extracts it and then load images which were inside the zip.

有关如何在运行时解压缩和访问图像的任何想法?对于某些想法真的很开心。

Any ideas how to unzip in run-time and the access the images? Would be really happy for some idea.

问候,

推荐答案

我过去曾成功使用 ZipArchive

它非常轻巧,使用简单,支持密码保护,ZIP内的多个文件,以及压缩和放大解压缩。

It's pretty ligthweight and simple to use, supports password protection, multiple files inside a ZIP, as well as compress & decompress.

基本用法是:

NSString *filepath = [[NSBundle mainBundle] pathForResource:@"ZipFileName" ofType:@"zip"];
ZipArchive *zipArchive = [[ZipArchive alloc] init];
[zipArchive UnzipOpenFile:filepath Password:@"xxxxxx"];
[zipArchive UnzipFileTo:{pathToDirectory} overWrite:YES];
[zipArchive UnzipCloseFile];
[zipArchive release];

这篇关于iPhone:在运行时下载zip并在主bundle子目录中解压缩的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆