awss3transfermanager后台上传成功但不在桶中

时间:2015-12-02 21:41:15

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

我正在使用AWSS3TransferManager将文件直接上传到s3。我从上传块中收到成功消息,但它没有出现在s3管理控制台的存储桶中。当我直接访问网址时,它会出现。我需要将它添加到存储桶中,因为我的应用程序从sqs队列中提取以便在数据库中创建对象。

以下是我上传的代码:

let uploadFileRequest = AWSS3TransferManagerUploadRequest()
uploadFileRequest.bucket = AWS.S3BucketName


uploadFileRequest.key = uploadFileName
uploadFileRequest.contentType = "video/quicktime"
uploadFileRequest.contentLength = NSNumber(integer: video!.length)

let transferManager = AWSS3TransferManager.defaultS3TransferManager()
uploadFileRequest.body = uploadFileURL! 

transferManager.upload(uploadFileRequest).continueWithBlock({ (task) -> AnyObject! in
     if task.error != nil {
        print("video upload failed \(task.error)")
     } else {
        print("video upload succeeded")
        print("\(uploadFileName)")

     }
     return 1
})

更新: 我认为这可能是一个安全问题。这是我设置cognito的代码: 让credentialsProvider = AWSCognitoCredentialsProvider(regionType:

AWSRegionType.USEast1, identityPoolId: AWS.cognitoPoolID)
let configuration = AWSServiceConfiguration(region: AWSRegionType.USEast1, credentialsProvider: credentialsProvider)
AWSServiceManager.defaultServiceManager().defaultServiceConfiguration = configuration

0 个答案:

没有答案