I'm using AWS IOS SDK and trying to list all the files in a FOLDER.
This code works to list all files etc in a BUCKET:
-(void) s3DirectoryListing: (NSString *) bucketName {
s3Client = [[AmazonS3Client alloc] initWithAccessKey:ACCESS_KEY withSecretKey:SECRET_KEY];
@try {
S3ListObjectsRequest *req = [[S3ListObjectsRequest alloc] initWithName:bucketName];
S3ListObjectsResponse *resp = [s3Client listObjects:req];
NSMutableArray* objectSummaries = resp.listObjectsResult.objectSummaries;
for (int x = 0; x < [objectSummaries count]; x++) {
NSLog(@"objectSummaries: %@",[objectSummaries objectAtIndex:x]);
}
}
@catch (NSException *exception) {
NSLog(@"Cannot list S3 %@",exception);
}
}
So if I pass a bucketName name, this works. However if I try and pass bucketName/folderName" I get an error message. This code doesn't seem to like the combination of bucket and folder path combinations.
Any ideas appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…