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

Torch Object Storage

Copy page
Download PDF
Bucket Interface
Retrieving Bucket Metadata (iOS SDK)
Copy page
Download PDF
Retrieving Bucket Metadata (iOS SDK)
A storage bucket serves as a container for storage objects; this operation can verify the existence of a bucket and retrieve the bucket's metadata.​
Sample Code​
The following code demonstrates how to retrieve the metadata of a bucket.​
​
​
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];​
​
TOSHeadBucketInput *head = [TOSHeadBucketInput new];​
head.tosBucket = @"bucket-name";​
TOSTask *task = [client headBucket:head];​
[task continueWithBlock:^id(TOSTask *task) {​
if (!task.error) {​
NSLog(@"Head bucket success.");​
TOSHeadBucketOutput *output = task.result;​
} else {​
NSLog(@"Head bucket failed, error: %@" ,task.error);​
}​
return nil;​
}];​
​
​
Last updated: 2025.09.25 16:40:50