更新时间:2022-09-13 GMT+08:00
分享

列举对象

当完成一系列上传对象操作后,可能需要查看桶中包含哪些对象。以下代码展示如何列举指定桶中的对象:

OBSListObjectsRequest *request = [[OBSListObjectsRequest alloc] initWithBucketName:@"bucketname"];
request.maxKeys = [NSNumber numberWithInt:10];
request.origin = @"www.example1.com";
[client listObjects:request completionHandler:^(OBSListObjectsResponse *response, NSError *error) {
    NSLog(@"%d",response.contentsList.count);
}];
  • 调用listObjects返回OBSListObjectsResponse实例,该实例包含此次listObject请求的返回结果。
  • 上面的代码默认列举1000个对象(Object)。
  • 更丰富的列举功能,请参见列举对象
分享:

    相关文档

    相关产品