Skip to content

Instantly share code, notes, and snippets.

@isthisjoe
Last active December 15, 2015 01:59
Show Gist options
  • Save isthisjoe/5183886 to your computer and use it in GitHub Desktop.
Save isthisjoe/5183886 to your computer and use it in GitHub Desktop.
S3GetPreSignedURLRequest (100% works)
+ (NSURL*)getPreSignedURLForKey:(NSString*)key
{
AmazonS3Client *s3 = [[AmazonS3Client alloc] initWithAccessKey:kHBAmazonS3AccessKeyID withSecretKey:kHBAmazonS3SecretKey];
//Set up the request
S3GetPreSignedURLRequest * request = [[S3GetPreSignedURLRequest alloc] init];
request.bucket = kHBAmazonS3Bucket;
request.key = key;
request.expires = [NSDate dateWithTimeIntervalSinceNow:(NSTimeInterval)kHBAmazonPreSignedRequestExpireSeconds];
NSURL *url = [s3 getPreSignedURL: request];
return url;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment