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

Torch Object Storage

Copy page
Download PDF
Manage Objects
Enumerating Objects (iOS SDK)
Copy page
Download PDF
Enumerating Objects (iOS SDK)
This article presents sample code for listing objects, with a default maximum of 1,000 objects returned.​
Enumerated Objects​
The following code demonstrates how to list objects.​
​
​
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];​
​
TOSListObjectsInput *list = [TOSListObjectsInput new];​
list.tosBucket = @"tos-test";​
TOSTask *task = [_client listObjects:list];​
[task continueWithBlock:^id(TOSTask *task) {​
if (!task.error) {​
NSLog(@"List objects success.");​
TOSListObjectsOutput *output = task.result;​
} else {​
NSLog(@"List objects failed, error: %@" ,task.error);​
}​
return nil;​
}];​
​
​
Last updated: 2025.09.25 16:40:51