0

I'm trying to upload a zip file and facing this issues. When I try with the older version PutObject methods, the file is getting uploaded successfully but with the latest iOS sdk I am unable to upload file.

_expression = [AWSS3TransferUtilityUploadExpression new];
_expression.progressBlock = ^(AWSS3TransferUtilityTask task, NSProgress progress) {
    dispatch_async(dispatch_get_main_queue(), ^{
        // Do something e.g. Update a progress bar.

        NSLog(@"Upload Progress '%%'%lld",((task.progress.completedUnitCount*100)/(task.progress.totalUnitCount)));
    });
};

_completionHandler = ^(AWSS3TransferUtilityUploadTask task, NSError error) {
    dispatch_async(dispatch_get_main_queue(), ^{
        // Do something e.g. Alert a user for transfer completion.
        // On failed uploads, `error` contains the error object.

        if (!error) {
            NSLog(@"task completed");
        }
        else {
            NSLog(@"task completed with Error\n\n %@",error);
        }
    });
};

_transferUtility = [AWSS3TransferUtility defaultS3TransferUtility];

[[_transferUtility uploadFile:_uploadFileURL
                      bucket:_bucketName
                         key:_key
                 contentType:@"application/zip"
                  expression:_expression
            completionHander:_completionHandler] continueWithBlock:^id(AWSTask *task) {
    if (task.error) {
        NSLog(@"Error: %@", task.error);
    }
    if (task.exception) {
        NSLog(@"Exception: %@", task.exception);
    }
    if (task.result) {
        AWSS3TransferUtilityUploadTask *uploadTask = task.result;

        // Do something with uploadTask.
    }

    return nil;
}];

And getting following error:

Error Domain=com.amazonaws.AWSS3TransferUtilityErrorDomain Code=2 "(null)" UserInfo={Server=AmazonS3, Transfer-Encoding=Identity, Connection=close, Content-Type=application/xml, Date=Fri, 07 Oct 2016 08:10:37 GMT, x-amz-request-id=F481248FB3DAD978, x-amz-id-2=iWWS/ZrHxtAeIzMD5PmgvE52azggJYumGHNp6aLWB9NgeIfR56yty66n/JfP4SQ/behSLKChEfE=}
Naman Vaishnav
  • 1,069
  • 1
  • 13
  • 24
  • Hi, could you please provide more details about the issue? Which version of SDK are you using? Does it still happen with the latest 2.4.16 version of the SDK? Is it limited on simulators / actual devices? – Rohan Dubal Dec 16 '16 at 02:15
  • I was getting the same error output when device time was set into the future. – Ondrej Hanak Jan 17 '17 at 13:14

0 Answers0