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

Torch Object Storage

Copy page
Download PDF
Manage Objects
Deleting Objects (iOS SDK)
Copy page
Download PDF
Deleting Objects (iOS SDK)
This article presents example code for deleting objects.​
Sample Code​
The following code demonstrates how to delete an object.​
​
​
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];​
​
TOSDeleteObjectInput *input = [TOSDeleteObjectInput new];​
input.tosBucket = @"bucket-name";​
input.tosKey = @"object-name";​
TOSTask *task = [_client deleteObject:input];​
[task continueWithBlock:^id(TOSTask *task) {​
if (!task.error) {​
NSLog(@"Delete object success.");​
} else {​
NSLog(@"Delete object failed, error: %@" ,task.error);​
}​
return nil;​
}];​
​
​
Last updated: 2025.09.25 16:40:49