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

Torch Object Storage

Copy page
Download PDF
Bucket Interface
Deleting a Bucket (iOS SDK)
Copy page
Download PDF
Deleting a Bucket (iOS SDK)
This article presents sample code for deleting a bucket.​
Prerequisites​
  • All objects in the storage bucket have been deleted.​
  • All shards pending merge have been deleted.​
  • If multiple versions of an object exist, ensure that all versions of the object have been deleted.​
Sample Code​
The following code demonstrates how to delete empty 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];​
​
TOSDeleteBucketInput *delete = [TOSDeleteBucketInput new];​
delete.tosBucket = @"bucket-name";​
task = [client deleteBucket:delete];​
[task continueWithBlock:^id(TOSTask *task) {​
if (!task.error) {​
NSLog(@"Delete bucket success.");​
TOSDeleteBucketOutput *output = task.result;​
} else {​
NSLog(@"Delete bucket failed, error: %@" ,task.error);​
}​
return nil;​
}];​
​
​
Last updated: 2025.09.25 16:40:51