1

I have an app that needs to download some images from S3. I tried to setup a new CloudFront distribution, pointed the origin to my S3 bucket and wondering how will this change the way I access my images in my app. My app just request the images to S3 like that:

    S3GetObjectRequest *getObjectRequest = [[S3GetObjectRequest alloc] initWithKey:path withBucket:PICTURE_BUCKET];

    S3GetObjectResponse *getObjectResponse = [self.s3 getObject:getObjectRequest];

    UIImage *img = [[UIImage alloc]initWithData:getObjectResponse.body];

Here, PICTURE_BUCKET is the name of my S3 bucket and path is the name of the image (64758_244.jpg).

How could I access this image through CloudFront?

I've found that

iOS AWS SDK and CloudFront - accessing images

but I am new with Amazon Mobile Services development and I don't know how to do it.

Thanks.

Community
  • 1
  • 1
VICTORGS3
  • 203
  • 3
  • 13

1 Answers1

4

If your question is simply how to find the URL to access Cloudfront images, this is one method.

Hope this does the trick for you!

David Taiaroa
  • 25,157
  • 7
  • 62
  • 50
  • Hi David, thanks for your response. I have it really clear now. The only thing I don't have clear is now how to access to this image. I just have to create a NSData initialized with contentsOfURL where the URL is that cloudfront url? – VICTORGS3 Mar 18 '13 at 22:52
  • 1
    Hi Victor, apps aren't my dept. unfortunately. As a stab in the dark though, is there anything on this page that helps you? http://www.raywenderlich.com/5492/working-with-json-in-ios-5 – David Taiaroa Mar 19 '13 at 00:11
  • 1
    That's great ... I'm off to buy some lotto tickets ;) – David Taiaroa Mar 20 '13 at 00:48
  • I am facing issue to fetch image(private content) from amazon Cloud front in iOS app. I have no idea , How to fetch image/ file from cloud front in iOS . Please suggest it. – Vipulk617 Oct 07 '15 at 12:44
  • @vipulk617 , I"m not an iOS developer, but maybe you could check if the accepted answer @ http://stackoverflow.com/questions/30679544/is-it-impossible-to-use-aws-cloudfront-for-downloading-my-private-image-on-s3 is helpful – David Taiaroa Oct 07 '15 at 22:49
  • @David Taiaroa Thanks for giving valuable time for me. – Vipulk617 Oct 08 '15 at 04:36