Giter Site home page Giter Site logo

aws-sdk-ios-v1's Introduction

[ARCHIVED] Version 1 of the AWS SDK for iOS

Version 2 of the AWS Mobile SDK for iOS has reached General Availability (GA) and is no longer in Developer Preview. It is available on our aws-sdk-ios repository. Version 1 is deprecated as of September 29, 2014. If you are building new apps, we recommend you use Version 2.

aws-sdk-ios-v1's People

Contributors

carlj avatar carsonmcdonald avatar ecordell avatar flambert avatar glenndierkes avatar hyandell avatar stoffer avatar turacma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aws-sdk-ios-v1's Issues

Maintain AWSiOSSKD CocoaPod

I've updated the AWSiOSSDK CocoaPod to 1.7.0. Took me a while to figure out the existing one was point to 1.6.1. Can you take over maintenance of this as you release new versions?

S3PutObjectRequest stalls after sending some bytes

I'm uploading an .mp4 file using S3PutObjectRequest and AmazonS3Client.

- (void)uploadWithData:(NSData *)data videoName:(NSString *)videoName
{
    S3PutObjectRequest *putRequest = [[S3PutObjectRequest alloc] initWithKey:[NSString stringWithFormat:@"videos/%@", videoName] inBucket:BUCKET_NAME];
    putRequest.data = data;
    putRequest.cannedACL = [S3CannedACL publicRead];
    putRequest.delegate = self;
    [_s3Client putObject:putRequest];
}    
-(void)request:(AmazonServiceRequest *)request didSendData:(long long)bytesWritten totalBytesWritten:(long long)totalBytesWritten totalBytesExpectedToWrite:(long long)totalBytesExpectedToWrite {
    NSLog(@"did send data totalbyteswritten: %lld totalBytesExpected: %lld", totalBytesWritten, totalBytesExpectedToWrite);
}
-(void)request:(AmazonServiceRequest *)request didCompleteWithResponse:(AmazonServiceResponse *)response {

    NSLog(@"did complete: %@", response);
}
-(void)request:(AmazonServiceRequest *)request didFailWithError:(NSError *)error {
    NSLog(@"did fail: %@", error);
}

Console logs show:


2012-11-02 02:47:04.216 divinenight[1835:907] did send data totalbyteswritten: 32768l totalBytesExpected: 1890610l

2012-11-02 02:47:04.218 divinenight[1835:907] did send data totalbyteswritten: 65536l totalBytesExpected: 1890610l

2012-11-02 02:47:04.220 divinenight[1835:907] did send data totalbyteswritten: 98304l totalBytesExpected: 1890610l

2012-11-02 02:47:04.221 divinenight[1835:907] did send data totalbyteswritten: 131072l totalBytesExpected: 1890610l

2012-11-02 02:47:04.303 divinenight[1835:907] did send data totalbyteswritten: 163840l totalBytesExpected: 1890610l

2012-11-02 02:49:28.726 divinenight[1835:907] S3Response.m|-[S3Response connection:didFailWithError:]|234|UserInfo.NSErrorFailingURLStringKey = https://macdivinenight-beta.s3.amazonaws.com/videos%2F6b8060ac94be73a8aaf9f950a2c96712-1351804738.mp4

2012-11-02 02:49:28.731 divinenight[1835:907] S3Response.m|-[S3Response connection:didFailWithError:]|234|UserInfo.NSErrorFailingURLKey = https://macdivinenight-beta.s3.amazonaws.com/videos%2F6b8060ac94be73a8aaf9f950a2c96712-1351804738.mp4

2012-11-02 02:49:28.733 divinenight[1835:907] S3Response.m|-[S3Response connection:didFailWithError:]|234|UserInfo.NSLocalizedDescription = The Internet connection appears to be offline.

2012-11-02 02:49:28.735 divinenight[1835:907] S3Response.m|-[S3Response connection:didFailWithError:]|234|UserInfo.NSUnderlyingError = Error Domain=kCFErrorDomainCFNetwork Code=-1009 "The Internet connection appears to be offline." UserInfo=0x1f94f9d0 {NSErrorFailingURLKey=https://macdivinenight-beta.s3.amazonaws.com/videos%2F6b8060ac94be73a8aaf9f950a2c96712-1351804738.mp4, NSErrorFailingURLStringKey=https://macdivinenight-beta.s3.amazonaws.com/videos%2F6b8060ac94be73a8aaf9f950a2c96712-1351804738.mp4, NSLocalizedDescription=The Internet connection appears to be offline.}

2012-11-02 02:49:28.740 divinenight[1835:907] S3Response.m|-[S3Response connection:didFailWithError:]|237|An error occured in the request: Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." UserInfo=0x1f94e140 {NSErrorFailingURLStringKey=https://macdivinenight-beta.s3.amazonaws.com/videos%2F6b8060ac94be73a8aaf9f950a2c96712-1351804738.mp4, NSErrorFailingURLKey=https://macdivinenight-beta.s3.amazonaws.com/videos%2F6b8060ac94be73a8aaf9f950a2c96712-1351804738.mp4, NSLocalizedDescription=The Internet connection appears to be offline., NSUnderlyingError=0x1f94f420 "The Internet connection appears to be offline."}

2012-11-02 02:49:28.742 divinenight[1835:907] did fail: Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." UserInfo=0x1f94e140 {NSErrorFailingURLStringKey=https://macdivinenight-beta.s3.amazonaws.com/videos%2F6b8060ac94be73a8aaf9f950a2c96712-1351804738.mp4, NSErrorFailingURLKey=https://macdivinenight-beta.s3.amazonaws.com/videos%2F6b8060ac94be73a8aaf9f950a2c96712-1351804738.mp4, NSLocalizedDescription=The Internet connection appears to be offline., NSUnderlyingError=0x1f94f420 "The Internet connection appears to be offline."}

Basic issue is: after uploading just a few bytes, the request hangs for a few minutes before finally timing out. I've tried a clean install of the app, rebooting the device, creating a new IAM key for s3 permissions (gave it full admin permissions), nothing seems to fix it. It is 100% reproducable.

Any help? Odd thing is that the bug suddenly appeared recently and I haven't changed the code one bit. It was working for several weeks up until couple of days ago when a client reported the issue. Using 1.7.0.

Difference between 1.7.0 and 2.0.6 SDK Versions

Hello Yosuke,

I want to use AWS SDK for upload/Download a file in my iOS App. But now i saw there are two versions of iOS AWS SDK and bit confused which one to use.

I want t0 support following features as well in my app.

  1. Upload / download when app is in background
    2.. Pause and Resume feature for Upload / download
  2. When network goes and comes i want to resume my transfer
  3. I also want to maintain the offset values even if my app quits during any transfer was in progress.

Need your help in solving my problem.
Regards,
Chandrika

AWS S3Response object dealloc is crashing my app. Why?

I have an Xcode ObjC non-ARC app targetting iOS 5+. My PutObject and MultipartUpload requests are succeeding just fine. But sometime later, when the objects start to be released my app crashes. It's always the same stack dump. Here's the crash log for the thread:

Thread 1 name:  Dispatch queue: com.apple.root.default-priority
Thread 1 Crashed:
0   libobjc.A.dylib                 0x3a8295d0 objc_msgSend + 16
1   AppName                         0x000f3084 -[AmazonServiceResponse dealloc] (AmazonServiceResponse.m:250)
2   AppName                         0x00183c72 -[S3Response dealloc] (S3Response.m:320)
3   libobjc.A.dylib                 0x3a82b490 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 164
4   libdispatch.dylib               0x3882d6dc _dispatch_root_queue_drain + 412
5   libdispatch.dylib               0x3882d7d4 _dispatch_worker_thread2 + 88
6   libsystem_c.dylib               0x3a2eb7ee _pthread_wqthread + 358
7   libsystem_c.dylib               0x3a2eb680 start_wqthread + 4

Adding a podspec for 1.4.4 for use with cocoapods

Hi there,

I'd like to use this SDK with cocoapods but the latest version with a podspec is 1.3.3. I tried adding a podspec myself but was unsuccessful. Could you add a new podspec to https://github.com/CocoaPods/Specs , or perhaps do you see what's wrong with the following?

Thanks,

Francesco

Here's the modified spec I tried to use:

Pod::Spec.new do |s|
  s.name         =  'AWSiOSSDK'
  s.version      =  '1.4.4'
  s.license      =  'https://github.com/aws/aws-sdk-ios/blob/master/LICENSE.txt'
  s.summary      =  'Amazon Web Services SDK for iOS.'
  s.homepage     =  'http://aws.amazon.com/sdkforios'
  s.author       =  { 'Amazon Web Services' => 'amazonwebservices' }
  s.source       =  { :git => 'https://github.com/aws/aws-sdk-ios.git', :commit => 'f9238cfc4c4da4f84e79203d5b6b8a8439a2befe'}
  s.description  =  'The AWS SDK for iOS provides a library, code samples, and documentation for developers to build connected mobile applications using AWS.'
  s.platform     =  :ios

  s.header_mappings_dir = 'src/include'

  s.subspec 'DynamoDB' do |ss|
    ss.source_files = "src/Amazon.DynamoDB/**/*.m", "src/include/DynamoDB/*.h"
    ss.dependency 'AWSiOSSDK/Runtime'
  end

  s.subspec 'Runtime' do |ss|
    ss.source_files = "src/Amazon.Runtime/**/*.m", "src/include/*.h"
    ss.dependency 'AWSiOSSDK/DynamoDB'
    ss.dependency 'AWSiOSSDK/GMT-Logger'
    ss.dependency 'SBJson'
  end

  # TODO: GTM should be an external dependency.
  s.subspec 'GMT-Logger' do |ss|
    ss.source_files = 'src/ThirdParty/GTM*.{h,m}'
  end

  # S3 does not build because it needs a Constants.h file defined by clients
  %w[ AutoScaling CloudWatch DynamoDB EC2 ElasticLoadBalancing S3 SES SNS SQS STS SimpleDB ].each do |name|
    s.subspec name do |ss|
      ss.source_files = "src/Amazon.#{name}/**/*.m", "src/include/#{name}/*.h"
      ss.dependency 'AWSiOSSDK/Runtime'
    end
  end
end

but it fails with the following error:

$pod spec lint AWSiOSSDK.podspec 

 -> AWSiOSSDK (1.4.4)
    - ERROR | XCODEBUILD >  AWSiOSSDK/src/Amazon.DynamoDB/DynamoDBResponse.m:66:34: error: use of undeclared identifier 'AmazonErrorHandler'
    - ERROR | XCODEBUILD >  AWSiOSSDK/src/Amazon.DynamoDB/DynamoDBResponse.m:82:40: error: use of undeclared identifier 'AmazonErrorHandler'
    - ERROR | XCODEBUILD >  AWSiOSSDK/src/Amazon.DynamoDB/DynamoDBResponse.m:98:38: error: use of undeclared identifier 'AmazonErrorHandler'
    - ERROR | XCODEBUILD >  AWSiOSSDK/src/Amazon.DynamoDB/DynamoDBResponse.m:106:69: error: use of undeclared identifier 'AmazonErrorHandler'
    - ERROR | XCODEBUILD >  AWSiOSSDK/src/Amazon.DynamoDB/DynamoDBResponse.m:121:38: error: use of undeclared identifier 'AmazonErrorHandler'
    - ERROR | XCODEBUILD >  AWSiOSSDK/src/Amazon.DynamoDB/DynamoDBResponse.m:133:69: error: use of undeclared identifier 'AmazonErrorHandler'
    - WARN  | Git sources without tag should be marked as 0.0.1 (not always applicable)

Analyzed 1 podspec.

[!] The spec did not pass validation.

Mac OS X support

For the most part, this library works perfectly well in Mac OS X. There are only a couple of issues that need to be resolved for it to build. If that work were to be done, would that pull request be accepted or is this strictly an iOS-centric project?

Mac version

Is there any port to mac os x of the latest version with file transfer?

Exceptions should be used for programming/unexpected runtime errors only, not error conditions

Except from Apple's Introduction to Exception Programming Topics for Cocoa:

Important: You should reserve the use of exceptions for programming or unexpected runtime errors such as out-of-bounds collection access, attempts to mutate immutable objects, sending an invalid message, and losing the connection to the window server. You usually take care of these sorts of errors with exceptions when an application is being created rather than at runtime...
Instead of exceptions, error objects (NSError) and the Cocoa error-delivery mechanism are the recommended way to communicate expected errors in Cocoa applications.

Aside from being generally un-Cocoa, using exceptions to indicate error conditions leads to awkward development experiences when using Xcode's "All Exceptions" breakpoint while debugging.

Crash after canceling S3 GetObject request in S3TransferManager

This is in version 1.71.

The crash usually occurs at S3GetObjectResponse (connection:didReceiveData:)

Use case:

S3TransferManager* tm = [[S3TransferManager alloc] init]
S3GetObjectRequest* get = ...
S3TransferOperation* op = [tm download:get]

after a little while

[op cancel]

Depending on how (un)lucky you get, you may see the crash.

The problem is at S3GetObjectOperation_Internal.m (line 262). The didReceiveResponse method forgets to cancel the underlying getRequest. Instead, it cleans up and finishes and deallocates, but S3GetObjectOperation_Internal is still set as the delegate on the S3GetObjectRequest. When the S3GetObjectResponse receives data, it the zombie S3GetObjectOperation_Internal can cause a crash.

FIX:

Add [self.getRequest cancel]; to S3GetObjectOperation_Internal around line 262.

S3 server throws 403 error if Date Header for a S3GetObjectRequest is more than 15 minutes old.

I am downloading a large amount of data (3.5 GB, ~1123 files and folders) from S3 to an iOS device. Like clockwork, the server will return a 403 error with no response body every 15 minutes. This is caused by the "Date" header of a S3GetObjectRequest being more than 15 minutes old.

I am using the transfer manager to download file as follows:

self.transferManager = [[S3TransferManager alloc] init];
self.transferManager.delegate = self;
self.transferManager.s3 = self.amazonS3Client;

[self.remoteFilesToDownload enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSString *filePath, BOOL *stop) {
        [self.transferManager downloadFile:filePath bucket:self.bucketName key:key];
    }
}];

self.remoteFilesToDownload is a dictionary, where the keys are the keys from S3ObjectSummaries and the value is a filePath for where files will be saved.

When I run this code, the server will return a 403 status code for one of the downloads about 15 minutes after I start the download process.

I have traced the error to the S3Request class. The date property is being set once when the process begins, but the date header is not set until the actual download begins. My download process can take as long as 40 minutes. The transfer manager needs to support longer downloads.

If you want to reproduce the issue change the following S3Request method:

-(NSDate *)date
{
    if (_date == nil) {
        _date = [[NSDate date] retain];
    }
    return _date;
}

to

-(NSDate *)date
{
    if (_date == nil) {
        _date =[[[NSDate date] dateByAddingTimeInterval:16*60] retain];
    }
    return _date;
}

Every download will fail because the date header in the configureURLRequest method is more than 15 minutes old.

I noticed you don't seem to accept pull requests, so I am posting my solution below:

-(AmazonURLRequest *)configureURLRequest
{
    [super configureURLRequest];
    [self setHttpMethod:kHttpMethodGet];

    [self.urlRequest setValue:[NSString stringWithFormat:@"%lld", self.contentLength] forHTTPHeaderField:kHttpHdrContentLength];

    [self.urlRequest setValue:self.host forHTTPHeaderField:kHttpHdrHost];

    self.date = [NSDate date];
    [self.urlRequest setValue:[self.date stringWithRFC822Format] forHTTPHeaderField:kHttpHdrDate];

    if (nil != self.httpMethod) {
        [self.urlRequest setHTTPMethod:self.httpMethod];
    }
    if (nil != self.contentType) {
        [self.urlRequest setValue:self.contentType forHTTPHeaderField:kHttpHdrContentType];
    }
    if (nil != self.securityToken) {
        [self.urlRequest setValue:self.securityToken forHTTPHeaderField:kHttpHdrAmzSecurityToken];
    }

    [self.urlRequest setURL:self.url];

    return urlRequest;
}

Basically, I make sure the date header is initialized every time the configureURLRequest method is called instead of using the date value from when the Request was created.

Invalid request serialization

When creating an AWS SNS Platform Endpoint with AWS SDK v2 like this

AWSSNSCreatePlatformEndpointInput *input = [[AWSSNSCreatePlatformEndpointInput alloc] init];
input.platformApplicationArn = kSCSAWSSNSApplicationARN;
input.token = @"0123456789012345678901234567890123456789012345678901234567891234";
input.attributes = @{@"Enabled": @"true"};
BFTask *createPlatformEndpointTask = [sns createPlatformEndpoint:input];

createPlatformEndpointTask.error is nil while createPlatformEndpointTask.result returns an AWSSNSCreateEndpointResponse where the endpointArn is nil. The request is not successful though.

After further inspection I found out that the request serializer does not seem to handle the attributes dictionary correctly. The HTTPBody which is generated is

"Token=0123456789012345678901234567890123456789012345678901234567891234&Attributes={\n    Enabled = true;\n}&Version=2010-03-31&Action=CreatePlatformEndpoint&PlatformApplicationArn=<sns platform application arn here>"

while it should be

"Token=0123456789012345678901234567890123456789012345678901234567891234&Attributes.1.key=Enabled&Attributes.1.value=true&Version=2010-03-31&Action=CreatePlatformEndpoint&PlatformApplicationArn=<sns platform application arn here>"

When setting input.attributes to nil the request is successful.

Weird import issues when used via CocoaPods

In S3TransferManager.h the imported file AWSRuntime/AmazonServiceRequest.h is not found when using the sdk via CocoaPods.

#ifdef AWS_MULTI_FRAMEWORK 
#import <AWSRuntime/AmazonServiceRequest.h>
#else 
#import "../AmazonServiceRequest.h"
#endif

Replacing that with the following solves the issue
#import "AmazonServiceRequest.h"

Crash writing file in AWSURLSessionManager

Versions 2.1.1 of the SDK, installed via cocoapods, iOS 8.4.1

I don't have any more details, as this crash came through mobile crash reporting.

Looking at the code, it looks like some more graceful error handling would be useful when writing the data.

Thread : Fatal Exception: NSFileHandleOperationException
0  CoreFoundation                 0x0000000181d1822c __exceptionPreprocess
1  libobjc.A.dylib                0x00000001939e40e4 objc_exception_throw
2  CoreFoundation                 0x0000000181d1816c -[NSException initWithCoder:]
3  Foundation                     0x0000000182bcdf00 _NSFileHandleRaiseOperationException
4  Foundation                     0x0000000182bce870 -[NSConcreteFileHandle writeData:]
5  myApp                        0x00000001001621fc -[AWSURLSessionManager URLSession:dataTask:didReceiveData:] (AWSURLSessionManager.m:560)
6  CFNetwork                      0x00000001817554d0 __67-[NSURLSession delegate_dataTask:didReceiveData:completionHandler:]_block_invoke275
7  Foundation                     0x0000000182bff1c4 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__
8  Foundation                     0x0000000182b50604 -[NSBlockOperation main]
9  Foundation                     0x0000000182b401cc -[__NSOperationInternal _start:]
10 Foundation                     0x0000000182c01f28 __NSOQSchedule_f
11 libdispatch.dylib              0x0000000194061954 _dispatch_client_callout
12 libdispatch.dylib              0x000000019406c0a4 _dispatch_queue_drain
13 libdispatch.dylib              0x0000000194064a5c _dispatch_queue_invoke
14 libdispatch.dylib              0x000000019406e318 _dispatch_root_queue_drain
15 libdispatch.dylib              0x000000019406fc4c _dispatch_worker_thread3
16 libsystem_pthread.dylib        0x000000019424121c _pthread_wqthread
17 libsystem_pthread.dylib        0x0000000194240ee0 start_wqthread

Crashes in AWSURLSessionManager

I ported an app to AWS 2.x a month or so ago and after lots of initial bugs in AWS 2.x things started working. For some time as I have added new features to the app it crashes fairly often. I just decided to take a look a what was happening and I'm having troubles finding the problem.

All the crashes (both SIGABRT and EXC_BAD_ACCESS) happen somewhere in:
[AWSURLSessionManager URLSession:task:didCompleteWithError]
...
[XMLDictionaryParser endText] or [XMLDictionaryParser parser:didStartElement...]

I have tried to find out where in my code I make AWS calls that get these crashes, but it seems to happen in a lot of places inside AWS SDK. Has anybody else seen anything like this? Does anybody have any suggestions on how to find out why I am getting these crashes?

screen shot 2014-09-25 at 10 29 46 pm

S3 single part throttling stream uploading ?

How we can upload throttling stream using S3 aws-sdk-ios.
The S3UploadInputStream was deprecated after the release of iOS6. So what is best solution to upload throttling stream to amazon server?

Nonce should not be a UUID

In AmazonAuthUtils.m there is a method called +nonce which is used to create nonce words. The method is implemented like this:

+(NSString *)nonce
{
    CFUUIDRef uuid   = CFUUIDCreate(kCFAllocatorDefault);
    NSString  *nonce = [(NSString *)CFUUIDCreateString(kCFAllocatorDefault, uuid) autorelease];

    CFRelease(uuid);

    return nonce;
}

I may be wrong here but usually nonce values should be randomly generated. A UUID might not be made out of random bits - depending on the type of the UUID. In fact it is nowhere documented what kind of UUID CFUUIDCreate is creating. If you look in the source code of CF then you will see a lot of #ifdefs that make also use of time instead of random bits.

Even if CFUUIDCreate is creating truly random UUIDs now it is not clear that this won't change. In addition using a UUID here is also semantically incorrect because a nonce is usually just a random arrangement of bytes. As already mentioned UUIDs are not inherently random.

As I already mentioned: I could be totally wrong here but I would use arc4random_uniform(...) to create random and uniformly distributed 32 bit values and then chain them together but I am sure that there is a convenience function somewhere in CommonCrypto.

NSPOSIXErrorDomainCode 12

NSPOSIXErrorDomainCode 12 " The operation could not be completed. Cannot allocate memory"

Whenever I test the app on my phone I get this error

Tags for older releases

Hey there AWSers, I've been spring cleaning the CocoaPods/Specs repo and am trying to remove the last few commit references to in our specs, and there are a few for older versions of this SDK. Any chances you guys can tag these releases?

AWSiOSSDK - 1.2.2 (f730a57586a7eb8a0e83e888ad06c954e25806ba)
AWSiOSSDK - 1.3.3 (4fb867331360a16dfc472849791e584a621967bf)
AWSiOSSDK - 1.4.0 (d1480b647b381d948a3546f8ead72e821bd3ecc1)
AWSiOSSDK - 1.4.1 (38e89549cc995d763ec7759f8da1423b59699860)
AWSiOSSDK - 1.4.2 (bc1f55670b03f2474aa1ae2b560608d3f388f19b)
AWSiOSSDK - 1.4.3 (f3954ffd0acdb2110a8f0db1bebfed36c81546e9)

Bucket Logging & Notifications

Is there anywhere in the sdk to get the AWS Bucket Logging and Notifications setting?

Ive searched high and low.

Thanks.

Socket: Broken Pipe

I'm using this library to upload files from about 0.3MB-1MB. Every once in a while I get a "Socket: Broken Pipe" Failure. (I used charles proxy to see why it was not uploading.)

There's 2 issues I'm encountering. The first is that I'm getting this broken pipe issue at all. It's not that infrequent. I can usually queue up about 20 requests and have it happen. Looking at the failed vs succeeded requests, the only difference I see is that the connection is kept alive for these failed requests after several non-kept-alive requests, but it also has requests kept-alive that succeed. The keep alive stuff may be totally irrelevant though. If I retry the upload, it works fine. The failed upload is uploading to the same remote ip address that worked for the previous request only milliseconds before. All requests are done in serial.

The second issue is in how the sdk reports the issue. I encounter an immediate failure in the http response according to charles, but the aws sdk doesn't report an issue until it the timeout duration is up and gives the error message "Request timed out."

Do you have any suggestions on fixing these issues and is there any more information I can provide?

Threading issue

Description:

I have three controllers. The first is a tweaked version of AVCAM offered by Apple that involves using the AVFramework to create a custom photo/video capture controller, a controller that allows a user to annotate a photo/video and then another controller that I display once this annotating is done. The controller flow is done in this order, with a user capturing the content, annotating, and then displaying this last controller.

The issue the arises when either transitioning from the mark up to the last view controller or progressively dismissing the stack (i.e. dismissing the last controller, loading the view from the annotate controller that contains the s3 code and then dismissing this to return to the first (camera) controller). I perform a putobject request on the mark up (2nd in stack) controller. This has been working well until recently when I encounter this issue:
screen shot 2014-07-28 at 3 06 56 pm

screen shot 2014-07-28 at 3 07 04 pm

screen shot 2014-07-28 at 3 07 07 pm

This does not crash all threads, as my camera controller preview layer is still reading a buffer. However, the main thread seems to halt as no more selectors or actions can be received. I know v2 is out and I should be developing with that but I need a working app now. This seems to just be something to do with the way aws threads the upload response handlers so I am seeking on advice on how to do this. For reference I only have didcompleteWithResponse: delegate method written and not didSendBodyData:.

Please add semantic version tags

I’ve recently added aws-sdk-ios to the CocoaPods package manager repo.

CocoaPods is a tool for managing dependencies for OS X and iOS Xcode projects and provides a central repository for iOS/OS X libraries. This makes adding libraries to a project and updating them extremely easy and it will help users to resolve dependencies of the libraries they use.

However, aws-sdk-ios doesn't have any version tags. I’m adding the current HEAD as version 0.0.1, but a version tag will make dependency resolution much easier.

Semantic version tags (instead of plain commit hashes/revisions) allow for resolution of cross-dependencies.

In case you didn’t know this yet; you can tag the current HEAD as, for instance, version 1.0.0, like so:

$ git tag -a 1.0.0 -m "Tag release 1.0.0"
$ git push --tags

Support ConditionalOperator in DynamoDBScanRequest?

Currently the filter conditions set for a DynamoDBScanRequest are evaluated using the AND operator: they all have to be true for the item to be included in the scan results. The API supports a ConditionalOperator field (see docs) that can be used to change this behaviour to OR. The iOS SDK doesn’t seem to implement the ConditionalOperator field. I’d be happy to write the code and submit a pull request, would you merge it?

PutObject requests time out when using temporary credentials

I'm running in a bizarre issue when attempting to use temporary credentials to upload a file to S3 from an iOS app. The app works perfectly fine with a set of IAM credentials - uploads go right up. However, using temporary credentials, I get callbacks to request:didSendData:totalBytesWritten:totalBytesExpectedToWrite: for the correct amount of data, but then no apparent response or completion callback at all. request:didCompleteWithResponse: is never called, and request:didFailWithServiceException: is called with a timeout once I hit the overall timeout limit for the S3Client object.

Using the same temporary credentials with the Ruby SDK works just fine to upload a file, so I assume that this is somehow an iOS-SDK-specific thing. I'm not sure what the next best step are to troubleshoot, however. I have verbose logging turned on but nothing is reported after the request is started.

Any ideas/thoughts? I'm pretty much stumped at this point.

README should include note for where to find framework files

The Github hosted code does not include the Framework files which is momentarily confusing when you try to run any of the sample apps and get linking errors.

Please include a note in the README that all frameworks can be downloaded from the main site at http://aws.amazon.com/sdkforios by clicking the button shown below. Then you have to link them into the sample apps.

screen shot 2013-09-03 at 1 18 36 pm

Keep up the great work!

download progress

Hey,with upload progress already implemented it would be great to have download progress too instead of having to do some funky calculations on the didReceiveData call ;)

use cocoapods

Please use cocoapods so we can install the library with ease

EC2DescribeInstanceAttributeRequest does not generate correct request

[AmazonLogger verboseLogging];
EC2ModifyInstanceAttributeRequest * request = [EC2ModifyInstanceAttributeRequest new];
[request setInstanceId:self.instanceId];
[request setDisableApiTermination:YES];
[EC2ModifyInstanceAttributeResponse * reponse = [[AWSClientManager EC2] modifyInstanceAttribute:request];

Generated request
ec2.amazonaws.com
/
?Action=ModifyInstanceAttribute&DisableApiTermination=true&InstanceId=&

Error Response (it's a 400 error)

InvalidRequestThe request received was invalid.5698f99d-72cb-4253-ae14-03c694d69b2b

According to the official EC2 API document, the attribute parameter should be like this attr-name.Value, e.g.
https://ec2.amazonaws.com/?Action=ModifyInstanceAttribute&InstanceId=i-10a64379&Kernel.Value=aki-f70657b2&

Massive data allocation in _NSMutableGrowBytes

I have a big memory management problem in the S3 framework, I have tried to download a big file with:

AmazonCredentials *credentials = [[AmazonCredentials alloc] initWithAccessKey: accessKey withSecretKey: secretKey];
    AmazonS3Client *connection = [[AmazonS3Client alloc] initWithCredentials: credentials];
    S3GetObjectRequest *downloadRequest = [[S3GetObjectRequest alloc] initWithKey:fileName withBucket: bucket];
    [downloadRequest setDelegate: self];
    [connection getObject: downloadRequest];

But the app crash with a memory warning in the didReceiveData: delegate

-(void)request:(AmazonServiceRequest *)request didReceiveData:(NSData *)data

the responsable appear to be a _NSMutableGrowBytes object

here the xcode allocation profile:
2013-05-13 12 41 48 pm

Why the framework appending this huge quantity of byte on this data structure?

SignatureDoesNotMatch problems

Ive been trying to get file downloading to work on my ios app and in the end tried to run your s3 samples by just inputting my key and secret and still same error so could you please let me know how one is supposed to use this if not even the sdk samples can get it working properly?

Memory leak in AmazonAbstractWebServiceClient when calling initWithCredentials:

Hi,

I have found in AmazonClientManager on static method +(void)initClients, when initializing web service client i.e:

[sns release];
sns = [[AmazonSNSClient alloc] initWithCredentials:credentials];
sns.endpoint = [AmazonEndpoints snsEndpoint:US_EAST_1];

It will goes to call AmazonAbstractWebServiceClient initialization method initWithCredentials, and make a double call to [self init].

I try to use a workaround, not to call initWithCredentials: but use initWithCredentialsProvider instead, and the leak has gone:

AmazonStaticCredentialsProvider *provider = [[AmazonStaticCredentialsProvider alloc] initWithCredentials:credentials];
[sns release];
sns = [[AmazonSNSClient alloc] initWithCredentialsProvider:provider];
sns.endpoint = [AmazonEndpoints snsEndpoint:US_EAST_1];

[provider release];

Here's the code on AmazonAbstractWebServiceClient that cause the leak:

@implementation AmazonAbstractWebServiceClient
...

- (id)init
{
    if (self = [super init]) {
        _maxRetries = 5;
        _timeout = 240;
        _connectionTimeout = 0;
        _delay = 0.2;
        _userAgent = [[AmazonSDKUtil userAgentString] retain];
    }

    return self;
}

-(id)initWithCredentials:(AmazonCredentials *)credentials
{
    if (self = [self init]) {
        AmazonStaticCredentialsProvider *provider = [[AmazonStaticCredentialsProvider alloc] initWithCredentials:credentials];
        [self initWithCredentialsProvider:provider];
        [provider release];
    }

    return self;
}

-(id)initWithCredentialsProvider:(id<AmazonCredentialsProvider>)provider
{
    if (self = [self init]) {
        _provider = [provider retain];
    }

    return self;
}

Missing .gitignore

Please add a .gitignore file with at least xcuserdata included. I constantly have to go in and remove the folder each time I open my project.

Can't upload file larger than 196608 bytes to S3

I'm not sure if this is the correct place for this but I'm having an issue uploading a video to S3. I followed the photo upload example here with some minor modifications for video.

I'm logging the response in the didSendData delegate method. Uploads seem to stop at byte 196608. Files smaller than that upload fine. Larger files show totalBytesWritten at 196608.

It's my first time using the SDK so it could be a problem with my code which I'm including below.

    AmazonS3Client *s3 = [[AmazonS3Client alloc] initWithAccessKey:AWS_ACCESS_KEY withSecretKey:AWS_SECRET_KEY];
    S3PutObjectRequest *por = [[S3PutObjectRequest alloc] initWithKey:@"test.mov" inBucket:@"bucketname"];
    por.contentType = @"video/quicktime";
    NSData *videoData = [NSData dataWithContentsOfURL:_videoURL];
    por.data = videoData;
    por.delegate = self;
    [s3 putObject:por];

S3 client doesn’t retry when a timeout occurs.

First things first, I’m not sure if it’s related, but before anything else I call:

[AmazonErrorHandler shouldNotThrowExceptions];

Now when a timeout occurs, I would expect the S3 client to retry the request until the ‘maxRetries’ is reached. However, it does not and this is because -[AmazonAbstractWebServiceClient shouldRetry:exception:] is returning NO.

What’s happening is that the NSError is expected to be a real NSURLErrorDomain one, whereas the one that’s being checked is wrapped in a AWS ClientErrorDomain, as can be seen in the console in this screenshot:

screen shot 2013-06-27 at 11 56 42 am

After backtracking a bit more, I noticed that this timeout isn’t actually from the NSURLConnection layer, but from -[AmazonServiceResponse timeout] here.

As I understand it atm, there are a couple of issues with the way this timeout is handled:

  1. A AmazonClientException is instantiated instead of a AmazonServiceException, which leads to -[AmazonErrorHandler errorFromException:] to return an error with the AWSiOSSDKClientErrorDomain domain. In this process no real metadata about the error is being communicated, except for a sparse message.
  2. Then the delegate method is called on -[S3PutObjectOperation_Internal request:didFailWithError:] here, which creates a new exception instance, but this time of the appropriate type AmazonServiceException, but again only with the original sparse error message.

This all leads to there not being any real metadata on the error domain and code by the time it reaches -[AmazonAbstractWebServiceClient shouldRetry:exception:] and so the request is never retried.

For now, I’m going to try to make the -[AmazonServiceResponse timeout] method generate a NSError with the NSURLErrorDomain domain and the kCFURLErrorTimedOut error code.

SBJSON needs to be removed as a dependency - duplicate symbols

Please don't include open source libraries/code as a library dependency. It breaks the build process (duplicate symbols) for any other app or library that also includes SBJson (other open source dependencies).

I think that making a library or something for SBJson and then having developers link against it would fix the issue.

I'm using an older version of the Facebook SDK and I had to manually rename all the SBJson files in my ASW fork to get my project to build. I have SBJson included in my project. I believe the newer version of Facebook SDK also embeds SBJson, but I haven't attempted to migrate to it yet.

Screen Shot 2012-12-12 at 2 49 59 PM

SIGSEGV [S3Response connection:didReceiveResponse:]

I have an app in the store which uses an async uploads to S3, however, I'm seeing this error come through my crash handlers.

Binary Image Name Address Symbol

0 latergram 0x000fc8d4 testflight_backtrace
1 latergram 0x000fc114 TFSignalHandler
2 libsystem_platform.dylib 0x38247722 _sigtramp
3 latergram 0x001924be -[S3Response connection:didReceiveResponse:] in S3Response.m on Line 155
4 Foundation 0x2ddda246 __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke
5 Foundation 0x2ddda188 -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]
6 Foundation 0x2ddda0a4 -[NSURLConnectionInternal _withActiveConnectionAndDelegate:]
7 Foundation 0x2ddda062 _NSURLConnectionDidReceiveResponse
8 CFNetwork 0x2d101964 ___ZN27URLConnectionClient_Classic28_delegate_didReceiveResponseEP14_CFURLResponse_block_invoke
9 CFNetwork 0x2d0feeba ___ZN27URLConnectionClient_Classic18_withDelegateAsyncEPKcU13block_pointerFvP16_CFURLConnectionPK33CFURLConnectionClientCurrent_VMaxE_block_invoke_2
10 CoreFoundation 0x2d3ce1d8 CFArrayApplyFunction
11 CFNetwork 0x2d096ad2 _ZN19RunloopBlockContext7performEv
12 CFNetwork 0x2d096990 _ZN17MultiplexerSource7performEv
13 CFNetwork 0x2d096820 _ZN17MultiplexerSource8_performEPv
14 CoreFoundation 0x2d465fe6 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION
15 CoreFoundation 0x2d4654ae __CFRunLoopDoSources0
16 CoreFoundation 0x2d463c9e __CFRunLoopRun
17 CoreFoundation 0x2d3ce7a8 CFRunLoopRunSpecific
18 CoreFoundation 0x2d3ce58a CFRunLoopRunInMode
19 GraphicsServices 0x3233b6d2 GSEventRunModal
20 UIKit 0x2fd2d890 UIApplicationMain
21 latergram 0x000c045a main in main.m on Line 17
22 libdyld.dylib 0x3812dab6 start

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.