Upload images to AWS S3 using AWS iOS SDK v2
Why Stack Overflow recommends it
Stack Overflow users link it as the walkthrough they followed when trying to upload a UIImage to an S3 bucket from iOS, usually while debugging Cognito or signature errors.
Recommended by 0 people across 0 different months, 2015 to 2016.
What it is
A 40-minute tutorial by Sledge Dev showing how to set up AWS S3 with the AWS Mobile SDK v2 for iOS and upload images from an app, using Cognito for authentication. Sample projects for Objective-C and Swift (iOS 8) are on GitHub, and the author warns the audio quality is poor.
What people said
Cites GeeGoldz · 2015-01 · Stack Overflow · on “How to resolve an error when uploading an image with AWS on iOS”
I am following this tutorial [this video] which involves uploading a UIImage to an s3 bucket using cognito for authentication. I am able to connect to cognito because my device is showing in the identity pool. However, when I try to upload the image to a bucket, I get this error: Error Domain=com.amazonaws.AWSGeneralErrorDomain Code=3 "The request signature we calculated does not match the signature you provided. Check your key and signing method." UserInfo=0x17dc0f40 {NSLocalizedDescription=The request signature we calculated does not match the signature you provided. Check your key and signing method.} The cognito authentication policy looks like this: { "Version": "2012-10-17", "Statement": [{
Cites user3766930 · 2016-03 · Stack Overflow · on “How can I upload an image from my ios app to my bucket stored on aws s3 and do all of that in Swift?”
There are lots and lots examples of that written in obj C, but I'm looking for a Swift solution. So far all I could find is this one [LINK] but it's not that clear for me. I already configured the s3 on aws webpage, I also created and filled file Constans.swift : import AWSS3 import Foundation let CognitoRegionType = AWSRegionType.XXXXX let DefaultServiceRegionType = AWSRegionType.XXXXX let CognitoIdentityPoolId = "MyCognitoIdentityPoolId" let S3BucketName = "MyS3BucketName" I also added the following lines to AppDelegate.swift : let credentialsProvider = AWSCognitoCredentialsProvider(regionType: CognitoRegionType, identityPoolId: CognitoIdentityPoolId) let configuration = AWSServiceConfigur
Cites Lazar Kukolj · 2016-08 · Stack Overflow · on “How to upload a UIImage to S3 with AWS iOS SDK v2”
This is an updated answer so people don't have to figure it out themselves (like me) :D Import the proper files (download it here [LINK] ) #import <AWSCore/AWSCore.h> #import <AWSS3TransferManager.h> .m - (void)viewDidLoad { [super viewDidLoad]; AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1 identityPoolId:@"us-east-1:*******-******-*****-*****-*****"]; AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSEast1 credentialsProvider:credentialsProvider]; AWSServiceManager.defaultServiceManager.defaultServiceConfiguration = configuration; } I used a button to know when