【问题标题】:Store and Retrieve Files with Amazon S3 using iOS SDK使用 iOS 开发工具包通过 Amazon S3 存储和检索文件
【发布时间】:2016-05-23 10:09:39
【问题描述】:

我像下面这样配置了AWSServiceManager

let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "us-east-1:ccd38470-cc11-4d1d-9437-83a6491af009")
let defaultServiceConfirguration = AWSServiceConfiguration(region: .USEast1, credentialsProvider: credentialProvider)
AWSServiceManager.defaultServiceManager().defaultServiceConfiguration = defaultServiceConfirguration

我正在关注AWSS3TransferManager guide,使用 Pod 安装的 iOS SDK 将文件存储到 S3 中。但我收到如下错误,

错误域=com.amazonaws.AWSS3ErrorDomain 代码=0 "(null)" UserInfo={HostId=zT0n9AYnVcKe0w9oXuahIB4DNyNoy9ABFzk5MFNVCs8/RJbQpiq52Ejp0X2BfA+w6BnpPZxSkE=, Bucket=mybucket, Endpoint=s3TestApp.s3.amazonaws.com, Message=The 您尝试访问的存储桶必须使用 指定的端点。请将所有未来的请求发送到此端点。, 代码=永久重定向,请求 ID=95F73C956B7FB36

this thread 我发现他们正在使用类似[downloadRequest setEndpoint:@"s3-eu-west-1.amazonaws.com.com"]; 的东西到S3GetObjectRequest 对象。

但首先在这里我尝试上传文件并使用 Swift 而不是 Objective-C。 我想通知我要上传的根存储桶内还有更多存储桶。

谁能帮我解决这个问题。

【问题讨论】:

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


    【解决方案1】:

    你说的方法是从版本一的SDK,不适用于版本二的SDK。

    您需要将正确的区域设置为AWSServiceConfiguration 对象。详情请见this sample

    【讨论】:

    • 请查看我编辑的问题。我已经按照您的建议配置了AWSServiceManager。我在EndPoint 上遇到了错误
    • 您的存储桶s3TestApp 不在.USEast1 中。您需要正确配置服务配置对象。
    • 不,它在USEast1 地区。
    猜你喜欢
    • 2015-12-09
    • 1970-01-01
    • 1970-01-01
    • 2015-06-11
    • 2020-01-24
    • 2023-04-09
    • 1970-01-01
    • 1970-01-01
    • 2017-05-12
    相关资源
    最近更新 更多