Amazon S3 video upload issue for the iOS SDK v2

Dear developers i have issue that is connected with Amazon S3 video upload.

I am using iOS SDK V2 for arrange interaction between iOS Client and Amazon. I already read all documentation and investigate manuals that were provider by the developers from the Amazon and some issues occurs that are not documented.

I will start explaining problem from very beginning.

1) Authentication, i am using STS approach to authenticate users for the Amazon s3 request. This steP is not a point due to that i am using this authentication configuration to upload images as well and everything work perfectly.

2) For the uploading of the Video file i am using:

AWSS3TransferManager

Sample code of the uploading:

AWSS3PutObjectRequest *logFile = [AWSS3PutObjectRequest new];
  logFile.bucket = uploadTokenData_.bucket;
  logFile.key = key;
  logFile.contentType = contentType;
  logFile.body = data_;
  logFile.contentLength = [NSNumber numberWithInteger:[data_ length]];

AWSS3 *S3 = [[AWSS3 alloc] initWithConfiguration:[AWSCredentialsProvider runServiceWithStsCredential]];

AWSS3TransferManager *transferManager = [[AWSS3TransferManager alloc] initWithS3:S3];

[[transferManager.s3 putObject:logFile] continueWithBlock:^id(BFTask *task)
{

  NSLog(@"Error : %@", task.error);
  if (task.error == nil)
  {
    NSLog(@"Uploadet");
  }
}

3) Problems that occure.

1) -1001: Almost immediate error response for the s3 file uploading to be more precise i will provide you debug line of the response from Amazon.

AWSiOSSDKv2 [Debug] AWSSignature.m line:642 | -[AWSS3ChunkedEncodingInputStream nextChunk] | stream read: 32677, chunk size: 32768

Domain=NSURLErrorDomain Code=-1001 "The request timed out."

2) It stack on random chunk of the file and stop uploading it to the server.And write network connection is lost, but Internet connection is up.

Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost."

4) Conclusion

But nevertheless this approach upload video files to the Amazon from time to time and it is quite strange.For example from very morning i upload video file for 77 MB and now each time i receive.

Domain=NSURLErrorDomain Code=-1001

If someone know or even have some ideas how to solve this problem please give me some advise.

Thanks a lot for your time!


When you instantiate instances of AWSS3 or AWSS3TransferManager (instead of using defaultS3 or defaultS3TransferManager ), you need to manually retain strong references to the client objects. In your code snippet, your transfer manager object can be released before putObject: completes, and the S3 client can subsequently be released, too.

You can use -setService:forKey: on defaultServiceManager of AWSServiceManager to have the service manager manage the strong references for you.

链接地址: http://www.djcxy.com/p/22362.html

上一篇: 使用GitLab CI持续交付

下一篇: 针对iOS SDK v2的Amazon S3视频上传问题