私はAWS iOSフレームワークを使用しており、すべてのS3バケットをリストしています。私はS3バケットの領域を見つけようとしていますが、領域値を取得していますが、領域 "eu-west-1"では領域文字列が無効であるという例外がスローされます。AWS iOS S3例外:無効な地域文字列
@try {
NSLog(@"\nViewWillappear");
NSLog(@"---------------------------------List Buckets-------------------------");
AmazonS3Client *s3 = [AmazonClientManager s3];
NSArray *bucketNames = [s3 listBuckets];
for(int i=0;i<[bucketNames count];i++)
{
S3Bucket *bucket=[bucketNames objectAtIndex:i];
**This is the line where i get exception
NSLog(@"region:%@",[s3 getBucketLocation:bucket.name]);**
NSLog(@"---------------------------------List Of Objects in Bucket %@-------------------------",bucket.name);
NSArray *listofobjects=[[AmazonClientManager s3]listObjectsInBucket:bucket.name];
for(int j=0;j<[listofobjects count];j++)
{
S3ObjectSummary *sumarry=[listofobjects objectAtIndex:j];
NSLog(@"\nstorage class%@ size%d",sumarry.storageClass,sumarry.size);
}
}
if (buckets == nil) {
buckets = [[NSMutableArray alloc] initWithCapacity:[bucketNames count]];
}
else {
[buckets removeAllObjects];
}
if (bucketNames != nil) {
for (S3Bucket *bucket in bucketNames) {
[buckets addObject:[bucket name]];
}
}
[buckets sortUsingSelector:@selector(compare:)];
}
@catch (AmazonClientException *exception) {
NSLog(@"Exception = %@", exception);
}
あなたはちょうどあなたが同じエラーを取得しているかどうかを確認するために、「EU-西-1」領域で新しいバケットを作成するには、例えば、試したことがありますか? "EU"(eu-west-1の有効なエイリアス)はどうですか? AWSはS3ドキュメントのどこでも有効な値として "eu-west-1"のリストを表示するだけなので、興味があります。 – Viccari
私の知るところによると、EUは有効な値ですが、AWS REST APIを使い、sdkも同じREST APIを使用していることを知りました。 APIで、彼らはEUが有効な値だと言いましたが、私の場合はEu-west-1を取得しています –
文書によれば、どちらも有効です: "有効値:EU | eu-west-1 | us-west-1 | US-west-2 | ap-southeast-1 | ap-northeast-1 | sa-east-1 |空の文字列(US Classic Regionの場合)」([API](http://docs.amazonwebservices。 com/AmazonS3/latest/API/RESTBucketPUT.html)) – Viccari