我有一个与亚马逊iOS Mobile SDK v2 相关的问题。我有一个任务是在提供的存储桶内创建一个空文件夹。要创建一个空文件夹,我使用方法:
- (void)createDirectory:(AWSS3Object *)directory inBucket:(AWSS3Bucket *)bucket success:(void (^)())success failure:(void (^)(NSError *error))failure
{
NSString *configurationKey = [NSString string];
if (self.configurationType == AmazonServiceConfigurationTypeDefault)
{
configurationKey = S3ConfigurationKey;
}
else if (self.configurationType == AmazonServiceConfigurationTypeHUB)
{
configurationKey = S3HUBConfigurationKey;
}
else if (self.configurationType == AmazonServiceConfigurationTypeTemporary)
{
configurationKey = S3TemporaryConfigurationKey;
}
AWSS3 *s3 = [AWSS3 S3ForKey:configurationKey];
AWSS3PutObjectRequest *putObjectRequest = [AWSS3PutObjectRequest new];
putObjectRequest.key = directory.key;
putObjectRequest.bucket = bucket.name;
putObjectRequest.body = [NSString string];
[[s3 putObject:putObjectRequest] continueWithBlock:^id(AWSTask *task)
{
if (task.error)
{
NSError *error = task.error;
failure(error);
}
else
{
success();
}
return nil;
}];
}
使用此方法,我总是收到错误:The request signature we calculated does not match the signature you provided
。
我的访问权限和安全密钥是正确的。
根据以前的经验,由于参数不正确,我习惯了这个错误。
我的密钥: AWS iOS SDK v2 Test/test/
我的水桶: abc-test
以前,当我使用AWS iOS Mobile SDK v1时,实际上相同的代码就像魅力一样。
有谁知道,问题出在哪里?
答案 0 :(得分:0)
我能够重现这个问题,问题的原因是键值的尾部斜线已被NSURL.path
剥离,导致错误的请求签名错误。我们将在以后的版本中修复AWS Mobile SDK。感谢您引起我们的注意。