亚马逊 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 }];
学习时的痛苦是暂时的 未学到的痛苦是终生的