亚马逊 IOS sts s3上传

 1 // aws oss
 2 AWSBasicSessionCredentialsProvider *credentialsProvider = [[AWSBasicSessionCredentialsProvider alloc] initWithAccessKey:accessKeyId
 3                                                                                                              secretKey:accessKeySecret
 4                                                                                                           sessionToken:securityToken];
 5 AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionAPSoutheast1
 6                                                                     credentialsProvider:credentialsProvider];
 7 [AWSServiceManager defaultServiceManager].defaultServiceConfiguration = configuration;
 8 
 9 AWSS3TransferUtilityUploadExpression *profileImageUploadExpression = [AWSS3TransferUtilityUploadExpression new];
10 [profileImageUploadExpression setValue:@"public-read-write" forRequestParameter:@"x-amz-acl"];
11 
12 AWSS3TransferUtility *transferUtility = [AWSS3TransferUtility defaultS3TransferUtility];
13 [transferUtility uploadData:data
14                     bucket:bucketName
15                        key:filePath
16                contentType:@"image/jpeg"
17                 expression:profileImageUploadExpression
18          completionHandler: ^(AWSS3TransferUtilityUploadTask *task, NSError *error) {
19              
20          }];
21 }];

 

posted @ 2022-02-10 18:00  爱你爱自己  阅读(631)  评论(0编辑  收藏  举报