Last active
December 15, 2015 01:59
-
-
Save isthisjoe/5183886 to your computer and use it in GitHub Desktop.
S3GetPreSignedURLRequest (100% works)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ (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