You need to enable JavaScript to run this app.
Torch Object Storage

Torch Object Storage

Copy page
Download PDF
Bucket Interface
Enumerating Buckets (iOS SDK)
Copy page
Download PDF
Enumerating Buckets (iOS SDK)
A bucket is a container for storing objects. This operation returns a list of all buckets.​
Sample Code​
The following code demonstrates how to list all buckets.​
​
​
TOSCredential *credential = [[TOSCredential alloc] initWithAccessKey:@"accesskey" secretKey:@"secretkey" securityToken:@"securityToken"];​
TOSEndpoint *tosEndpoint = [[TOSEndpoint alloc] initWithURLString:@"endpoint" withRegion:@"region"];​
TOSClientConfiguration *config = [[TOSClientConfiguration alloc] initWithEndpoint:tosEndpoint credential:credential];​
TOSClient *client = [[TOSClient alloc] initWithConfiguration:config];​
​
TOSListBucketsInput *listBuckets = [TOSListBucketsInput new];​
TOSTask *task = [client listBuckets:listBuckets];​
[task continueWithBlock:^id(TOSTask *task) {​
if (!task.error) {​
NSLog(@"List buckets success.");​
TOSListBucketsOutput *output = task.result;​
} else {​
NSLog(@"List buckets failed, error: %@" ,task.error);​
}​
return nil;​
}];​
​
​
Last updated: 2025.09.25 16:40:50