Sample code for 30+ languages & platforms
Objective-C

S3 Delete Multiple Objects

See more Amazon S3 Examples

Demonstrates how to delete multiple objects in a single HTTP request.

Chilkat Objective-C Downloads

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

BOOL success = NO;

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

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

// Insert your access key here:
http.AwsAccessKey = @"ABQXXABC83ABCDEFVQXX";

// Insert your secret key here:
http.AwsSecretKey = @"XXXXYYYYabcdABCD12345678xxxxyyyyzzzz";

NSString *bucketName = @"chilkattestbucket";

NSString *objectName1 = @"starfish.jpg";
// Delete a particular version of this object:
NSString *objectName2 = @"conch.jpg; VersionId=\"3/L4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo\"";
NSString *objectName3 = @"seaUrchin.jpg";

CkoStringTable *st = [[CkoStringTable alloc] init];
[st Append: objectName1];
[st Append: objectName2];
[st Append: objectName3];

CkoHttpResponse *resp = [[CkoHttpResponse alloc] init];
success = [http S3_DeleteObjects: bucketName objectNames: st jsonResponse: resp];
if (success == NO) {
    NSLog(@"%@",http.LastErrorText);
    return;
}

// Display the JSON response.
NSLog(@"%@",resp.BodyStr);