AFAmazonS3Client 2.0.1

AFAmazonS3Client 2.0.1

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Mar 2015

Maintained by Mattt.


Downloads

Total6,399
Week0
Month0

Installs

Apps155
Test Targets18
powered by Segment

AFAmazonS3Client is an AFHTTPRequestOperationManager subclass for interacting with the Amazon S3 API.

As the S3 API returns XML responses, you may find it useful to set AFOnoResponseSerializer as the response serializer.

Example Usage

AFAmazonS3Manager *s3Manager = [[AFAmazonS3Manager alloc] initWithAccessKeyID:@"..." secret:@"..."];
s3manager.requestSerializer.region = AFAmazonS3USWest1Region;
s3manager.requestSerializer.bucket = @"my-bucket-name";

NSString *destinationPath = @"/pathOnS3/to/file.txt";

[s3Manager postObjectWithFile:@"/path/to/file.txt"
              destinationPath:destinationPath
                   parameters:nil
                     progress:^(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) {
                        NSLog(@"%f%% Uploaded", (totalBytesWritten / (totalBytesExpectedToWrite * 1.0f) * 100));
}
                      success:^(id responseObject) {
                        NSURL *resultURL = [s3manager.requestSerializer.endpointURL URLByAppendingPathComponent:destinationPath];
                        NSLog(@"Upload Complete: %@", resultURL);
}
                      failure:^(NSError *error) {
                         NSLog(@"Error: %@", error);
}];

Contact

Mattt Thompson

License

AFAmazonS3Client is available under the MIT license. See the LICENSE file for more info.