AWS iOS S3异常:无效的区域字符串
我正在使用AWS iOS框架并列出我所有的S3存储桶。当我试图找出S3存储桶的区域时,我得到了区域值,但是对于区域“eu-west-1”,它抛出了一个异常,区域字符串无效 下面是示例代码:AWS iOS S3异常:无效的区域字符串,ios,amazon-s3,Ios,Amazon S3,我正在使用AWS iOS框架并列出我所有的S3存储桶。当我试图找出S3存储桶的区域时,我得到了区域值,但是对于区域“eu-west-1”,它抛出了一个异常,区域字符串无效 下面是示例代码: @try { NSLog(@"\nViewWillappear"); NSLog(@"---------------------------------List Buckets-------------------------"); AmazonS3Client *s3 = [Ama
@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);
}
@试试看{
NSLog(@“\nviewwillapper”);
NSLog(@“---------------------------------------列出存储桶-----------------”;
AmazonS3Client*s3=[AmazonClientManager s3];
NSArray*bucketNames=[s3 ListBucket];
对于(int i=0;i我是用于iOS的AWS SDK的维护者之一。我们修复了SDK中的一个错误,它没有正确处理某些区域字符串,特别是“eu-west-1”区域字符串
如果您升级到AWS SDK for iOS的1.4.3或更高版本,您将不再有问题
例如,您是否尝试过在“eu-west-1”区域创建一个新的存储桶,只是为了验证您是否得到了相同的错误?关于“eu”(它是eu-west-1的有效别名)呢?我只是好奇,因为AWS甚至列出了“eu-west-1”在S3文档中,EU是一个有效值。据我所知,EU是一个有效值,我通过AWS REST API了解到sdk也使用相同的REST API。在API中,他们提到EU是有效值,但在我的情况下,根据文档,我得到EU-west-1,两者都是有效的:“有效值:EU | EU-west-1 | us-west-1 | us-west-2 | ap-Southwest-1 | ap-Northwest-1 | sa-east-1 |空字符串(适用于美国经典地区)”(来自)您仍然面临这个问题吗?我在版本2.3.0中遇到了这个问题aslo@Sandesh请在GitHub存储库或论坛上打开一个问题,有人可以进一步帮助您。