I'm using the v2 AWS iOS SDK to upload my images to the server my code i strait forward
NSString * uniqueIdentifier = [[NSUUID UUID]UUIDString];
AWSS3TransferManagerUploadRequest *uploadRequest = [AWSS3TransferManagerUploadRequest new];
uploadRequest.bucket = @"my bucket";
uploadRequest.key = [NSString stringWithFormat:@"%@/images/%@.jpeg",objectId,uniqueIdentifier];
uploadRequest.ACL = AWSS3ObjectCannedACLPublicRead;
NSData * data = UIImageJPEGRepresentation(newImage, 0.8);
NSString *tmpDirectory = NSTemporaryDirectory();
NSString *tmpFile = [tmpDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.jpeg",uniqueIdentifier]];
NSLog(@"Temp File:%@", tmpFile);
[data writeToFile:tmpFile atomically:YES];
uploadRequest.body = [NSURL fileURLWithPath:tmpFile];
AWSS3TransferManager *transferManager = [AWSS3TransferManager defaultS3TransferManager];
[[transferManager upload:uploadRequest] continueWithExecutor:[BFExecutor defaultExecutor]
withBlock:^id(BFTask *task) {
if (task.error != nil) {
NSLog(@"%s %@","Error uploading :", uploadRequest.key);
}else {
AWSS3TransferManagerUploadOutput * output = task.result;
NSLog(@"Upload completed %@",[output description]);
}
return nil;
}];
after i upload the file to the S3 Service where is the response URL? how do i know the url for that image? i want to put the image inside an object in by DB.
thanks