Sample code for 30+ languages & platforms
Objective-C

Example: Http.S3_FileExists method

Demonstrates the S3_FileExists method.

Chilkat Objective-C Downloads

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

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

//  Insert your AWS keys here:
http.AwsAccessKey = @"AWS_ACCESS_KEY";
http.AwsSecretKey = @"AWS_SECRET_KEY";

NSString *bucketName = @"chilkat.ocean";
NSString *objectName = @"seahorse.jpg";
http.AwsRegion = @"us-west-2";
http.AwsEndpoint = @"s3-us-west-2.amazonaws.com";

int retval = [[http S3_FileExists: bucketName objectName: objectName] intValue];
if (retval < 0) {
    NSLog(@"%@",@"Failed to check for the S3 object existence");
    NSLog(@"%@",http.LastErrorText);
    return;
}

if (retval == 0) {
    NSLog(@"%@",@"The S3 object does not exist.");
    return;
}

NSLog(@"%@",@"The S3 object exists.");