我有一个iOS应用程序,我在大约一年前工作,并完美地从S3存储桶下载不同的资产。这是超过13个月前。
现在我需要对应用程序进行一些维护,在打开xcode 7.3.1中的代码并在模拟器中运行后,我收到一条消息
The request signature we calculated does not match the signature you provided. Check your key and signing method
我在下载资产后得到的这条消息,意味着我有大约3个mp4文件,每个文件大约20 mb,我可以下载它们,但是当下载完成后我转到模拟器中的文件夹所有4个文件在文件夹中每个都是6kb,当我检查文件时,我收到此消息
The request signature we calculated does not match the signature you provided. Check your key and signing method
我的凭据没有改变,我想知道这是否与iOS 9 SSL有关。
编辑: 以下是我在应用委托代理中验证凭据的方式
AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:CognitoRegionType
identityPoolId:CognitoIdentityPoolId];
AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:DefaultServiceRegionType
credentialsProvider:credentialsProvider];
AWSServiceManager.defaultServiceManager.defaultServiceConfiguration = configuration;
所有变量都在一个全局文件中
AWSRegionType const CognitoRegionType = AWSRegionUSEast1;
AWSRegionType const DefaultServiceRegionType = AWSRegionUSEast1;
NSString *const CognitoIdentityPoolId = @"xxxxxxxxxxxxxxxxx";
NSString *const S3BucketName = @"xxxxxxxxx";
答案 0 :(得分:0)
发现问题,我的结局是一个愚蠢的错误
我正在使用AWSS3GetPreSignedURLRequest,我无意中向下载请求添加了内容类型,这显然不需要,只有当您上传到S3时,您必须指定内容类型。删除该行代码后,我可以下载!!
AWSS3GetPreSignedURLRequest *getPreSignedURLRequest = [AWSS3GetPreSignedURLRequest new];
getPreSignedURLRequest.bucket = S3BucketName;
getPreSignedURLRequest.key = @"sometext";
getPreSignedURLRequest.HTTPMethod = AWSHTTPMethodGET;
//getPreSignedURLRequest.contentType = @"audio/mpeg"; this was the issue.