iPhone: Downloading zip and extracting in main bundle subdirectory at runtime

后端 未结 4 1835
夕颜
夕颜 2020-12-12 21:19

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

4条回答
  •  甜味超标
    2020-12-12 21:46

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

提交回复
热议问题