All Products
Search
Document Center

Object Storage Service:Get bucket information (iOS SDK)

Last Updated:Mar 20, 2026

Use the getBucketInfo: method to retrieve metadata about a bucket, including its region, creation date, storage class, owner, and access control list (ACL).

Prerequisites

Before you begin, ensure that you have:

  • An initialized OSSClient instance. For setup instructions, see Initialization

When initializing the OSSClient, specify an endpoint that maps to the region of the bucket.

Get bucket information

The following example retrieves information about examplebucket and logs its creation date, region, storage class, owner, and ACL.

OSSGetBucketInfoRequest *request = [OSSGetBucketInfoRequest new];
// Specify the bucket name.
request.bucketName = @"examplebucket";

OSSTask *getBucketInfoTask = [client getBucketInfo:request];

[getBucketInfoTask continueWithBlock:^id(OSSTask *task) {
    if (!task.error) {
        OSSGetBucketInfoResult *result = task.result;
        NSLog(@"Creation time: %@", result.creationDate);
        NSLog(@"Region: %@", result.Location);
        NSLog(@"Storage class: %@", result.storageClass);
        NSLog(@"Owner: %@", result.owner.userName);
        NSLog(@"ACL: %@", result.acl.grant);
    } else {
        NSLog(@"get bucket info failed, error: %@", task.error);
    }
    return nil;
}];

// Optional: block until the task completes.
// [getBucketInfoTask waitUntilFinished];

For the complete sample, see OSSBucketTests.m on GitHub.

What's next