Sample code for 30+ languages & platforms
Objective-C

List Files in a .zip

See more Zip Examples

How to list files within a .zip

Chilkat Objective-C Downloads

Objective-C
#import <CkoZip.h>
#import <CkoZipEntry.h>

BOOL success = NO;

//  This example requires the Chilkat API to have been previously unlocked.
//  See Global Unlock Sample for sample code.

CkoZip *zip = [[CkoZip alloc] init];

success = [zip OpenZip: @"a.zip"];
if (success == NO) {
    NSLog(@"%@",zip.LastErrorText);
    return;
}

//  Get the number of files and directories in the .zip
int n = [zip.NumEntries intValue];

CkoZipEntry *entry = [[CkoZipEntry alloc] init];

int i = 0;

while (i < n) {
    [zip EntryAt: [NSNumber numberWithInt: i] entry: entry];
    if (entry.IsDirectory == NO) {
        //  (the filename may include a path)
        NSLog(@"%@",entry.FileName);
    }

    i = i + 1;
}