Sample code for 30+ languages & platforms
Objective-C

Transition from Imap.FetchChunk to Imap.FetchRange

Provides instructions for replacing deprecated FetchChunk method calls with FetchRange.

Chilkat Objective-C Downloads

Objective-C
#import <CkoImap.h>
#import <CkoMessageSet.h>
#import <CkoEmailBundle.h>

BOOL success = NO;

CkoImap *imap = [[CkoImap alloc] init];

//  ...
//  ...

int startSeqNum = 1;
int count = 5;

CkoMessageSet *failedSet = [[CkoMessageSet alloc] init];
CkoMessageSet *fetchedSet = [[CkoMessageSet alloc] init];

//  ------------------------------------------------------------------------
//  The FetchChunk method is deprecated:

CkoEmailBundle *bundleObj = [imap FetchChunk: [NSNumber numberWithInt: startSeqNum] count: [NSNumber numberWithInt: count] failedSet: failedSet fetchedSet: fetchedSet];
if (imap.LastMethodSuccess == NO) {
    NSLog(@"%@",imap.LastErrorText);
    return;
}

//  ...
//  ...

//  ------------------------------------------------------------------------
//  Do the equivalent using FetchRange.
//  Your application creates a new, empty EmailBundle object which is passed 
//  in the last argument and filled upon success.

BOOL headersOnly = NO;

CkoEmailBundle *bundleOut = [[CkoEmailBundle alloc] init];
success = [imap FetchRange: headersOnly seqnum: [NSNumber numberWithInt: startSeqNum] count: [NSNumber numberWithInt: count] bundle: bundleOut];
if (success == NO) {
    NSLog(@"%@",imap.LastErrorText);
    return;
}