Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. There appear to be a number of solutions such as LiteUnzip , ZipArchive and a few others but none so apparently effective as these two. The problem I'm having is making either of them work in my Xcode 4 project.

LiteUnzip is in C and I have had extreme difficulty using it. 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.

ZipArchive seems to be the favorite around here, but I can't get it to compile without errors. 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:

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.

Has anybody had success in Xcode 4 with either of these libraries? Otherwise, do you know of a library that you have had success with?

like image 265
jakev Avatar asked Jan 21 '23 00:01

jakev


1 Answers

Here's what I ended up using: 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. No need to link static libraries or anything, just import the headers and go.

like image 60
jakev Avatar answered Jan 22 '23 15:01

jakev