質問

I am creating an application which unizp the files, after googling I found that we can use libz.dylib which is already available in Cocoa touch. What is strange to me that , I am not able to find any documents for libs.dylib. Can anyone provide me some official documentation ? And also if we want to unzip the files, everyone is suggesting to use some 3rd party libraries to unzip the files. Can't we do with the default libz.dylib ?

役に立ちましたか?

解決

you can do like this way:-

i found one greate answer in stack overflow below from this link download and unzip file in iOS please check below

I've used ZipArchive with success in the past. It's pretty ligthweight and simple to use, supports password protection, multiple files inside a ZIP, as well as compress & decompress.

The basic usage is:

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];

more examples about this package here

I have also tried SSZipArchive in some projects. Below line would unzip your zip file.

[SSZipArchive unzipFileAtPath:path toDestination:destination];

please also check the example hope its helps you :)

Edit

please visit this :-

libz.dylib versus libz.1.2.3.dylib versus libz.1.2.5.dylib

他のヒント

You can have a try of ZipArchive, which is the easiest lib I have used for zip/unzip affairs in both iOS and MacOS.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top