How to use the AWS SDK for IOS? [closed]

2020-03-19 02:04发布

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.

标签: iphone
3条回答
做个烂人
2楼-- · 2020-03-19 02:42

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.

查看更多
Bombasti
3楼-- · 2020-03-19 02:54

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

查看更多
够拽才男人
4楼-- · 2020-03-19 02:54

This is how I did it.

  1. Download the aws-ios-sdk or integrate it into your project using cocoapods. (Using cocoapods is really helpful).

  2. Add -Objc flag to your other linker flags of your build target.

  3. Make sure your build phases has Foundation.framework and libz.dylib added.

  4. On AWS Console create your app and go to the Cognito settings.

  5. Create a new identity pool.

  6. 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.

  7. This will provide you a startup code, use this exactly in your iOS code.

  8. 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.

  9. 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.

查看更多
登录 后发表回答