Sample code for 30+ languages & platforms
Objective-C

Transition from ZipEntry.NextEntry to ZipEntry.GetNext

Provides instructions for replacing deprecated NextEntry method calls with GetNext.

Chilkat Objective-C Downloads

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

BOOL success = NO;

//  ------------------------------------------------------------------------
//  The NextEntry method is deprecated.
//  See below or code showing how to rewrite using EntryAt/GetNext

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

success = [zip OpenZip: @"qa_data/zips/xml_files.zip"];
if (success != YES) {
    NSLog(@"%@",zip.LastErrorText);
    return;
}

CkoZipEntry *entry = [zip FirstEntry];
if (zip.LastMethodSuccess == NO) {
    NSLog(@"%@",@"This zip archive is empty.");
    return;
}

BOOL finished = NO;
while (finished == NO) {

    if (entry.IsDirectory == NO) {
        NSLog(@"%@",entry.FileName);
    }
    else {
        NSLog(@"%@%@",@"(directory) ",entry.FileName);
    }

    CkoZipEntry *next = [entry NextEntry];
    if (entry.LastMethodSuccess == NO) {
        finished = YES;
    }

    entry = next;
}

[zip CloseZip];

NSLog(@"%@",@"----");

//  ------------------------------------------------------------------------
//  Do the equivalent using EntryAt/GetNext.

success = [zip OpenZip: @"qa_data/zips/xml_files.zip"];

CkoZipEntry *ze = [[CkoZipEntry alloc] init];
[zip EntryAt: [NSNumber numberWithInt: 0] entry: ze];

BOOL entryValid = YES;
while (entryValid == YES) {

    if (ze.IsDirectory == NO) {
        NSLog(@"%@",ze.FileName);
    }
    else {
        NSLog(@"%@%@",@"(directory) ",ze.FileName);
    }

    entryValid = [ze GetNext];
}

[zip CloseZip];