Iam developing one application.In that i want to use the amazon web services.I downloaded the AWS SDK for IOS.But i dont know how to write the code for access the AWS.In this i want to use the AWS S3.SO please tell me how to do this.
-
Read about adding existing framework here: http://stackoverflow.com/questions/3352664/how-to-add-existing-frameworks-in-xcode-4 – Marek Sebera Oct 03 '11 at 06:28
3 Answers
Here's a simple sample app showing how to up/download files from Amazon S3 from your iOS App using Access & Secret Key credentials, i.e. NOT using Cognito which is only available in two regions at the moment: http://bit.ly/awss3v2ios

- 1,091
- 8
- 21
-
We strongly recommend you avoid embedding credentials in your application. What regions for Cognito would you require for your use case? – Bob Kinney Dec 30 '14 at 18:51
-
I would like to use AWSRegionAPSoutheast2. I would also very much appreciate better samples / documentation. This new V2 API has left me wasting hours trying to do the most simple things. Just trying to list all the objects in a bucket - haven't been able to do it yet, and I don't know whether it's code or configuration because all I get from Amazon is "The operation couldn’t be completed". Not great. – patschiboy Dec 31 '14 at 23:04
-
Have you tried posting on the AWS forums or here with your code? I appreciate that the V2 samples and docs may not be up to the standard you expect, but hearing specific feedback about the kinds of operations you're trying to do is the only way we can target our updates. – Bob Kinney Jan 01 '15 at 02:00
-
I figured it out now - the code was fine, but it turned out that I couldn't access 'old' buckets that were created years ago using the new API, probably would have needed to somehow set a specific endpoint, but the error messages weren't helping at all. Have now migrated all data into new buckets and all is fine. – patschiboy Jan 02 '15 at 02:31
-
@Bob I agree with patchiboy. I am trying to implement AWS. To give you an exact example, I am sure for many this will be stupid but I am still trying to find out what constant "RoleUnauth" is exactly. I know it relates to roles but the name or ARN I am still not sure. – darbid Mar 30 '15 at 09:04
-
@darbid It is the Role ARN. You may want to consider using the latest versions of the SDK, which include an updated auth flow that does not require you to configure roles in your application directly. – Bob Kinney Mar 30 '15 at 16:51
-
Thank you Bob. I saw a You Tube Video where he actually showed the AWS console and what he did. I thought that was great. I am now succeeding. I think my problem is that the SDK has changed so much that there is so much out there that is now out dated. Or deprecated. Even for example the Cognito example in the console says to cut and copy deprecated code. I know things are new and I hope it gets better. – darbid Mar 30 '15 at 17:14
This is how I did it.
Download the aws-ios-sdk or integrate it into your project using cocoapods. (Using cocoapods is really helpful).
Add -Objc flag to your other linker flags of your build target.
Make sure your build phases has Foundation.framework and libz.dylib added.
On AWS Console create your app and go to the Cognito settings.
Create a new identity pool.
In step 2 of this process, it'll ask you to provide IAM role. I tried using existing role but was not successful, so create a new IAM role and click update role.
This will provide you a startup code, use this exactly in your iOS code.
If you want to have full access to S3 (upload, download, change access settings, remove), then go to IAM section from the AWS console and add the S3 role policy to the role.
Now the AWS-Console setup is done and you can continue with accessing the S3 from your iOS code. You can find the necessary code in the sample app.

- 139
- 1
- 16
I was also strucked in this and sharing you my findings.You can easily integrate the AWS iOS sdk in your app. You have to create the cognito id to use this. Also for testing purpose you can test it directly with your credentials. However using credentials in the app is avoided.You can download the sample app and also get detailed description from here. Click here.

- 21
- 2