简体   繁体   English

适用于iPhone和Xcode 4的压缩/解压缩库

[英]Compression/Decompression library for the iPhone and Xcode 4

I have been working on a project that requires downloading a zipped file off a server, and am stuck trying to uncompress it on the iPhone. 我一直在研究一个需要从服务器上下载压缩文件的项目,并且我试图在iPhone上解压缩它。 There appear to be a number of solutions such as LiteUnzip , ZipArchive and a few others but none so apparently effective as these two. 似乎有许多解决方案,如LiteUnzipZipArchive和其他一些解决方案,但没有一个像这两个显然有效。 The problem I'm having is making either of them work in my Xcode 4 project. 我遇到的问题是让他们中的任何一个在我的Xcode 4项目中工作。

LiteUnzip is in C and I have had extreme difficulty using it. LiteUnzip在C中,我使用它时遇到了极大的困难。 If you have any example code on how to use it to unzip a single zipped file (containing about 60 files), that would be great. 如果您有任何关于如何使用它来解压缩单个压缩文件(包含大约60个文件)的示例代码,那就太棒了。

ZipArchive seems to be the favorite around here, but I can't get it to compile without errors. ZipArchive似乎是这里的最爱,但我不能让它编译没有错误。 I am following the instructions on http://code.google.com/p/ziparchive/issues/detail?id=4 , building a static library for iphone but I continue to get these kinds of errors: 我按照http://code.google.com/p/ziparchive/issues/detail?id=4上的说明操作,为iphone构建静态库但我仍然遇到以下类型的错误:

Undefined symbols for architecture armv6:
  "_crc32", referenced from:
      -[ZipArchive addFileToZip:newname:] in libziparchive.a(ZipArchive.o)
      _unzReadCurrentFile in libziparchive.a(unzip.o)

All the sources I've found have success building in Xcode 3.2, but I am working in Xcode 4. 我发现的所有资源都在Xcode 3.2中成功构建,但我在Xcode 4中工作。

Has anybody had success in Xcode 4 with either of these libraries? 有没有人在Xcode 4中使用这些库中的任何一个成功? Otherwise, do you know of a library that you have had success with? 否则,你知道你成功的图书馆吗?

Here's what I ended up using: http://code.google.com/p/objective-zip/ 以下是我最终使用的内容: http//code.google.com/p/objective-zip/

I'm using it like this: 我这样使用它:

#import "../Objective-Zip/ZipFile.h"
#import "../Objective-Zip/ZipException.h"
#import "../Objective-Zip/FileInZipInfo.h"
#import "../Objective-Zip/ZipWriteStream.h"
#import "../Objective-Zip/ZipReadStream.h"

ZipFile *unzipFile = [[ZipFile alloc] initWithFileName:zippedfile mode:ZipFileModeUnzip];
NSArray *infos = [unzipFile listFileInZipInfos];

etc... it's a really straightforward wrapper for ZLib and MiniZip. 等......对于ZLib和MiniZip来说,它是一个非常简单的包装器。 No need to link static libraries or anything, just import the headers and go. 无需链接静态库或任何东西,只需导入标题然后去。

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

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