Sample code for 30+ languages & platforms
Objective-C

Demonstrate S3_DownloadBytes

Demonstrates how to download a file into memory from the Amazon S3 service.

Chilkat Objective-C Downloads

Objective-C
#import <CkoHttp.h>
#import <NSString.h>
#import <CkoFileAccess.h>

BOOL success = NO;

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

CkoHttp *http = [[CkoHttp alloc] init];

http.AwsAccessKey = @"AWS_ACCESS_KEY";
http.AwsSecretKey = @"AWS_SECRET_KEY";

NSString *bucketName = @"chilkat.qa";
NSString *objectName = @"images/sea_creatures/starfish.jpg";
NSString *localFilePath = @"qa_output/starfish.jpg";

NSData jpgBytes;

jpgBytes = [http S3_DownloadBytes: bucketName objectName: objectName];
if (http.LastMethodSuccess != YES) {
    NSLog(@"%@",http.LastErrorText);
    return;
}

NSLog(@"%@",@"Download successful.");

CkoFileAccess *fac = [[CkoFileAccess alloc] init];
success = [fac WriteEntireFile: localFilePath fileData: jpgBytes];
NSLog(@"%@%d",@"File saved success = ",success);