使用iOS从S3中删除

时间:2016-01-28 00:09:41

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

我正在尝试使用AWS iOS SDK从S3存储桶中删除对象:

AWSS3DeleteObjectRequest *deleteObjectRequest = [AWSS3DeleteObjectRequest new];
deleteObjectRequest.bucket = kAmazonBucketName;
deleteObjectRequest.key = thumbnailFileName;

AWSS3 *s3 = [AWSS3 defaultS3];

[[s3 deleteObject:deleteObjectRequest] continueWithBlock:^id(AWSTask *task) {
    NSError *error = task.error;
    if (error) {
        NSLog(@"[AmazonAPIClient] Error deleting photo: %@", error.localizedDescription);
        if (completion)
            completion(NO);
    } else {
        NSLog(@"[AmazonAPIClient] Photo deleted");
    }
}

代码运行,我看到成功消息,但如果我通过AWS Web仪表板搜索我的S3存储桶,我发现文件仍在那里。

如何在iOS中删除存储桶中的文件?

请注意,我的存储区具有授予“Everyone”的读/写/删除权限。

0 个答案:

没有答案