2

I'm trying to add either request parameters or request headers to my transfer utility upload expression in order to be act as the holder for my metadata.

I'm adding them correctly to my knowledge and its uploading with its logged task.result showing the test header, however, when i check Cloudwatch the event records logged are not reflecting my parameters or headers.

Below is my code. What am I doing wrong?

    //create transfer utility

    AWSS3TransferUtility *transferUtility = [AWSS3TransferUtility defaultS3TransferUtility];


    //create expression

    AWSS3TransferUtilityUploadExpression *myExpression = [AWSS3TransferUtilityUploadExpression new];


   //create key

    NSString *myKey = @"testUpload";


    //add request parameters to expression

    [myExpression setValue:@"video" forRequestParameter:@"filetype"];


    //add request headers to expression

    [expression setValue:@"test" forRequestHeader:@"x-amz-test"];


    //begin upload

    [[transferUtility uploadData:fileData
                          bucket:@"textapp"
                             key:myKey
                     contentType:@"binary/octet-stream"
                      expression:myExpression
                completionHander:nil] continueWithBlock:^id(AWSTask *task) {
        if (task.error) {
            NSLog(@"Error: %@", task.error);

            UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"An error occurred!"
                                                                message:@"Please try sending your message again."
                                                               delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
            [alertView show];
        }
        if (task.exception) {
            NSLog(@"Exception: %@", task.exception);

        }
        if (task.result) {
            //AWSS3TransferUtilityUploadTask *uploadTask = task.result;
            // Do something with uploadTask.
             NSLog(@"Upload was complete!");
        }

        return nil;
    }];
ian
  • 1,002
  • 2
  • 12
  • 29

0 Answers0