【问题标题】:Amazon iOS Mobile SDK v2 Create empty folderAmazon iOS Mobile SDK v2 创建空文件夹
【发布时间】:2015-07-17 15:27:06
【问题描述】:

我有一个与 Amazon 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 时,几乎相同的代码一直在工作。

有谁知道,问题出在哪里?

【问题讨论】:

    标签: ios amazon-web-services amazon-s3 amazon


    【解决方案1】:

    我能够重现这个问题,问题的原因是键值的尾部斜杠已被NSURL.path 剥离,导致不正确的请求签名错误。我们将在未来版本中修复 AWS 移动开发工具包。感谢您提请我们注意。

    【讨论】:

    • 感谢您的回复!目前是否有可能解决这个问题?
    • 另外,您能否预测当前问题可能得到解决的时间?
    • 嗨@TomKortney,我们已经发布了适用于iOS 2.2.3 的AWS Mobile SDK,它解决了无法创建空目录的问题,有关更多详细信息,请参阅发布说明:aws.amazon.com/releasenotes/iOS/4731210461260864 谢谢.
    猜你喜欢
    • 2022-01-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-28
    • 1970-01-01
    • 2014-10-05
    • 1970-01-01
    • 2012-08-30
    相关资源
    最近更新 更多