Comments (9)
To be more specific, here's my example code:
NSString *tmpFile = [NSTemporaryDirectory() stringByAppendingPathComponent:@"temp_avatar.jpg"];
AFAmazonS3Manager *manager = [[AFAmazonS3Manager alloc] initWithAccessKeyID:@"---- MY_AWS_KEY -------" secret:@"------ MY_AWS_SECRET ------"];
manager.requestSerializer.bucket = @"my_bucket_name_on_S3";
manager.requestSerializer.regions = AFAmazonS3USStandardRegion;
[manager postObjectWithFile:tmpFile destinationPath:@"images/users/avatars" parameters:nil progress:^(NSUInteger bytesWritten, NSInteger totalBytesWritten, NSInteger totalBytesExpectedToWrite) {
NSLog(@"%f%% Uploaded", (totalBytesWritten / (totalBytesExpectedToWrite * 1.0f) * 100));
} success:^(id responseObject) {
NSLog(@"Upload Complete, %@", responseObject);
} failure:^(NSError *error) {
NSLog(@"Upload Complete");
}];
First of all I am not sure if I'm doing it right when i'm setting the buckets and regions on manager.requestSerializer
. I just figured it out looking at the code but all the example codes--since they're based on the older version--directly sets bucket and regions properties on AFAmazonS3Client
.
Also, I'm not sure what I'm supposed to be passing to destinationPath
parameter on postObjectWithFile
method. Is it the full path including the filename, or just the folder path to which I will be storing the file? (By the way I've tried both but neither works)
Lastly, is there something I should be doing that I'm not doing here? Thank you.
from afamazons3manager.
+1
from afamazons3manager.
+1
from afamazons3manager.
@polaski I'm in the process of integrating an iOS app which retrieves its images from Amazon S3. However, I'm not clear as to how to use this API from the given example. Did you resolve your issue? At this time, the example uses AFAmazonS3Manager. However, I have only been able to declare AFAmazonS3Client. Is there better documentation elsewhere which clearly explains how to use this client?
from afamazons3manager.
anybody?
from afamazons3manager.
I gave up with this, as it is completely unfathomable, switched to cloudfront with signed URLs and wrote a simple php script to generate the signed urls, then used AFDownloadRequestOperation to pull the data down to the app using the signed URLs. I used the same URL format to request URLs from my PHP script that Amazon uses for signed URLs, just didn't have the Amazon secret in the app to make it all more secure.
from afamazons3manager.
Ok, @jonathandring I found an old post from stack overflow, hahahah ironically written by me i know see, of how i solved this problem before
http://stackoverflow.com/questions/15069772/aws-s3-upload-image-to-bucket-ios-app
Basically I switched over to the AWS S3 cocoapod and have had great success with it. Currently used in a couple products I released. I'll find my code and put together a gist. Would you mind explaining what cloudfront and the signed URL thing is all about?
Maybe I'm not doing something I should be :)
from afamazons3manager.
Cloudfront is Amazons Content Distribution Network (CDN) which provides cached copies of S3 data worldwide, the content can be secured or unsecured:
http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html
Secured content is accessed using signed URLs, the following post explains how to generate the URLs with a server:
http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CreateURL_PHP.html
from afamazons3manager.
My sincere apologies for any inconvenience caused by vague and outdated documentation. I'm in the process of working through open PRs and issues now, and will be releasing updates soon.
from afamazons3manager.
Related Issues (20)
- Can't connect with Using SSE-C HOT 1
- OSX 10.10 upload image to s3 'method not allowed' HOT 1
- Request failed: forbidden (403) while using putObjectWithFile HOT 2
- Invalid Image URL (Not Opening as Web URL)
- Updates for AFNetworking 3 HOT 9
- PUT doesn't set a proper mimetype
- Move import of AFAmazonS3ResponseSerializer.h to AFAmazonS3Manager.h
- uploading problem
- All requests return 403 when the device time is off by more than 15 minutes
- EUWest2 not supported
- Complier Warning: "Auto property synthesis will not synthesize property" HOT 1
- Can't upload HOT 4
- Upload stops when phone goes to sleep and not resuming
- `putObjectWithFile:` returns NSURLErrorDomain -1012 with AFNetworking 2.5.3 + AFAmazonS3Manager 3.2.1 HOT 4
- Can't change content type of PUT file from octet/stream to image/jpeg HOT 4
- percent encoding in URL
- How to cancel AFAmazonS3Manager uploading process HOT 1
- XCode7/iOS9 download issues kCFStreamErrorDomainSSL
- XCode7/iOS9 download issues kCFStreamErrorDomainSSL HOT 1
- For some reason getObjectWithPath method from AFAmazonS3Manager is not working properly. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from afamazons3manager.