Вы можете сослаться на документацию для Amazon S3 Transfer Manager for iOS, содержащую всю информацию для интеграции SDK с тем, как загрузить и загрузить изображение из хранилища S3.
@property (nonatomic,strong) AWSS3TransferManager *transferManager;
-(void)uploadImage:(UIImage*)img
{
NSString *bucketName = @"bucket_Name";
NSString *fileName = [[[NSString stringWithFormat:@"%f",[[NSDate date] timeIntervalSince1970] * 1000] stringByReplacingOccurrencesOfString:@"." withString:@""] stringByAppendingString:@".png"];
fileName = [@"ios" stringByAppendingString:fileName];
NSString *path = [NSTemporaryDirectory() stringByAppendingString:fileName];
NSData *imageData = UIImagePNGRepresentation(img);
NSUInteger size = imageData.length;
[imageData writeToFile:path atomically:YES];
NSURL *url = [[NSURL alloc] initFileURLWithPath:path];
AWSS3TransferManagerUploadRequest *uploadRequest = [AWSS3TransferManagerUploadRequest new];
uploadRequest.bucket = bucketName;
uploadRequest.key = fileName;
uploadRequest.contentType = @"image/png";
uploadRequest.body = url;
uploadRequest.contentLength = [NSNumber numberWithUnsignedLongLong:size];
uploadRequest.uploadProgress = ^(int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend) {
dispatch_async(dispatch_get_main_queue(), ^{
if (totalBytesExpectedToSend > 0) {
weakself.file_size = totalBytesExpectedToSend;
weakself.file_uploaded = totalBytesSent;
[weakself updateProgress];
}
});
};
[[_transferManager upload:uploadRequest] continueWithExecutor:[AWSExecutor mainThreadExecutor] withBlock: ^id(AWSTask *task){
if (task.error)
{
NSLog(@"ERROR : %@",task.error);
}
else{
NSLog(@"Uploaded on : \n https://s3_path_for.amazonaws.com/%@/%@", bucketName, fileName);
UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Uploaded :)"
message:@""
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles: nil];
}
return nil;
}];
}
проверка по этим ссылкам: http://stackoverflow.com/q/12841587/4831524 или http://stackoverflow.com/q/12841587/4831524 –