使用 Amazon S3 Transfer Utility 为 iOS 设置元数据
Set metadata using Amazon S3 Transfer Utility for iOS
我找不到使用此库设置元数据的方法:Amazon S3 Transfer Utility for iOS
有办法实现吗?
您可以在 AWSS3TransferUtilityExpression
上使用 - setValue:forRequestParameter:
添加元数据。
注意 Amazon S3 以小写形式存储 user-defined 元数据。每个名称、值对必须符合 US-ASCII.
You can assign user-defined metadata to an object. User-defined metadata must begin with the prefix "x-amz-meta-", otherwise Amazon S3 will not set the key value pair as you define it. You define custom metadata by adding a name that you choose to the x-amz-meta- key. This creates a custom key. For example, if you add the custom name alt-name, the metadata key would be x-amz-meta-alt-name.
你可以参考这个 link : https://docs.aws.amazon.com/AmazonS3/latest/user-guide/add-object-metadata.html#add-object-metadata-user-defined
var uploadCompletion: AWSS3TransferUtilityUploadCompletionHandlerBlock?
uploadCompletion = { (uploadTask, error) in
if error == nil {
completion(nil)
} else {
completion(error)
}
}
let expression = AWSS3TransferUtilityUploadExpression()
//YOUR METADATA HERE
expression.setValue("value", forRequestParameter: "x-amz-meta-yourkeyhere")
let transferUtility = AWSS3TransferUtility.default()
transferUtility.uploadData(data,
bucket: s3BucketName,
key: key,
contentType: "image/png",
expression: expression,
completionHandler: uploadCompletion)
我找不到使用此库设置元数据的方法:Amazon S3 Transfer Utility for iOS
有办法实现吗?
您可以在 AWSS3TransferUtilityExpression
上使用 - setValue:forRequestParameter:
添加元数据。
注意 Amazon S3 以小写形式存储 user-defined 元数据。每个名称、值对必须符合 US-ASCII.
You can assign user-defined metadata to an object. User-defined metadata must begin with the prefix "x-amz-meta-", otherwise Amazon S3 will not set the key value pair as you define it. You define custom metadata by adding a name that you choose to the x-amz-meta- key. This creates a custom key. For example, if you add the custom name alt-name, the metadata key would be x-amz-meta-alt-name.
你可以参考这个 link : https://docs.aws.amazon.com/AmazonS3/latest/user-guide/add-object-metadata.html#add-object-metadata-user-defined
var uploadCompletion: AWSS3TransferUtilityUploadCompletionHandlerBlock?
uploadCompletion = { (uploadTask, error) in
if error == nil {
completion(nil)
} else {
completion(error)
}
}
let expression = AWSS3TransferUtilityUploadExpression()
//YOUR METADATA HERE
expression.setValue("value", forRequestParameter: "x-amz-meta-yourkeyhere")
let transferUtility = AWSS3TransferUtility.default()
transferUtility.uploadData(data,
bucket: s3BucketName,
key: key,
contentType: "image/png",
expression: expression,
completionHandler: uploadCompletion)