I am developing an iOS app using AWS as its backend. Since I expect users to be world wide, I need to switch where the app should download photos in order to increase latency performance. I have created a S3 bucket in EUWest1 and the other in APNorthEast1. As Yosuke said here (https://forums.aws.amazon.com/message.jspa?messageID=586581#586581), you can change the default configuration of AWSServiceManager.defaultServiceManager() from one region to another in order to prevent the error.
But, I still have the same error result even if I followed his tip. Error is:
Error Domain=com.amazonaws.AWSS3ErrorDomain Code=0 "The operation couldn’t be completed. (com.amazonaws.AWSS3ErrorDomain error 0.)" UserInfo=0x14fb7720 {RequestId=D708XXX8E1EDBXXX, Endpoint=bucket-ap-northeast-1.s3-ap-northeast-1.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., HostId=xxxY31S3yFhpssQe1EsfipWWLw=, Code=PermanentRedirect, Bucket=bucket-ap-northeast-1}
And this is my code:
var credentialsProvider = AWSCognitoCredentialsProvider.credentialsWithRegionType(kCognitoRegionType, accountId: kAWSAccountID, identityPoolId: kCognitoPoolID, unauthRoleArn: kCognitoRoleUnauth, authRoleArn: kCognitoRoleAuth)
var serviceConfiguration = AWSServiceConfiguration(region: AWSRegionType.APNortheast1, credentialsProvider: credentialsProvider)
AWSServiceManager.defaultServiceManager().setDefaultServiceConfiguration(serviceConfiguration)
var transferManager = AWSS3TransferManager.defaultS3TransferManager()
transferManager.download(downloadRequest)
Any advice is welcome! Thanks!