I try to upload file to s3 and I always got next error message
2015-08-05 14:35:53.931 BellyBuds[47981:2189296] Upload failed: [Error Domain=com.amazonaws.AWSS3ErrorDomain Code=0 "The operation couldn’t be completed. (com.amazonaws.AWSS3ErrorDomain error 0.)" UserInfo=0x7fd40a40d8f0 {HostId=wo/bHFvnQjGuiLic3IhL+jicVfeIcuR6M4HXz/nB9WRt/T09h16bbR77nkqKngzj, Bucket=bbbname, Endpoint=bbstagemusic.s3.amazonaws.com, Message=The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint., Code=PermanentRedirect, RequestId=6D250A718C640210}]
AWSCognitoCredentialsProvider *credProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1
identityId:[params valueForKey:@"IdentityId"]
identityPoolId:[params valueForKey:@"IdentityPoolId"]
logins:@{@"cognito-identity.amazonaws.com": params[@"Token"]}];
//credProvider.logins = @{ @(AWSCognitoLoginProviderKeyLoginWithAmazon): params[@"Token"] };
AWSServiceConfiguration *serviceConfiguration = [[AWSServiceConfiguration alloc]initWithRegion:AWSRegionUSEast1 credentialsProvider:credProvider];
AWSS3TransferManagerUploadRequest *uploadRequest = [AWSS3TransferManagerUploadRequest new];
uploadRequest.body = [NSURL fileURLWithPath:[BBFileManager getRecordingList][0]];
uploadRequest.key = [[BBFileManager getRecordingList][0] lastPathComponent];
uploadRequest.bucket = @"bbbucket";
AWSServiceManager *serv = [AWSServiceManager defaultServiceManager];
serv.defaultServiceConfiguration = serviceConfiguration;
[AWSS3TransferManager registerS3TransferManagerWithConfiguration:serviceConfiguration forKey:@"transferKey"];
[[[AWSS3TransferManager S3TransferManagerForKey:@"transferKey"] upload:uploadRequest] continueWithBlock:^id (AWSTask *task) {
return nil;
}];
I use correct data and set right region. I try use other regions and make other stuff, but this not be helpful. I always got errors related to regions and endpoint. What I do wrong?
Aucun commentaire:
Enregistrer un commentaire