Reputation: 186
I am using the AWS iOS framework and listing all my S3 buckets. While I am trying to find out the region of my S3 buckets, I am getting the region values, but for region "eu-west-1" it throws an exception that the region string is invalid.
Below is the sample code:
@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);
}
Upvotes: 0
Views: 2229
Reputation: 9020
I'm one of the maintainers of the AWS SDK for iOS. We've fixed a bug in the SDK where it was not properly handling certain region strings, particularly the "eu-west-1" region string.
If you upgrade to versions 1.4.3 or later of the AWS SDK for iOS, you should no longer have an issue.
Upvotes: 1