아마존 S3에 이미지를 업로드하고 파일에 대한 링크를 얻으려고합니다 (amazon s3에 ASIHTTPRequest 사용).amazon s3에 파일을 업로드하고 링크를 얻는 방법은 무엇입니까?
- (void) uploadAnImageToS3 {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[ASIS3Request setSharedSecretAccessKey:@"*****here I put my secretkey*****"];
[ASIS3Request setSharedAccessKey:@"*****here I put my key*****"];
NSData *imageData = [NSData dataWithData:UIImagePNGRepresentation(self.imageToPost)];
NSString * key = @"aKey"
ASIS3ObjectRequest *request = [ASIS3ObjectRequest PUTRequestForData:imageData withBucket:@"theBucketName" key:key];
[request setShouldCompressRequestBody:YES];
[request startSynchronous];
if (![request error]) {
//Here I should share a link for the put file, how do I get it? Is there any response from s3?
}
else {
NSLog(@"%@",[[request error] localizedDescription]);
}
[self performSelectorOnMainThread:@selector(stopActivity) withObject:self waitUntilDone:YES];
[pool release];
}
아, 주석없이 downvote 싫어! :(만약 당신이 너무 똑똑하다면 왜 당신은 질문에 대답하지 않았습니까 ?? – Stas