0

AWSS3TransferUtility通过(AWS-iOS-SDK v2.4.x)上传图像时,我正在努力定义缓存控制。

我的简化用法如下:

let utility = AWSS3TransferUtility.S3TransferUtilityForKey("key")
let data = UIImageJPEGRepresentation(image, 0.9)!

let expression = AWSS3TransferUtilityUploadExpression()
expression.progressBlock = { (task, progress) in
    onProgress?(progress: progress.fractionCompleted)
}

transferUtility.uploadData(data, bucket: GlobalConfig.awsS3DefaultBucket, key: "image.jpeg", contentType: "image/jpeg", expression: expression) { (task, error) in
    // ...
}

我目前的重点是表达,但调用 likeexpression.setValue("max-age=3600", forRequestParameter: "Cache-Control")不起作用。

4

1 回答 1

1

不要使用forRequestParameter使用forRequestHeader

例子:

let expression = AWSS3TransferUtilityUploadExpression()
expression.setValue("max-age=3600", forRequestHeader: "Cache-Control")
于 2019-05-12T17:27:58.327 回答