tencent cloud

Cloud Object Storage

DocumentationCloud Object StorageSDK DocumentationiOS SDKSetting Access Domain Names (CDN/Global Acceleration)

Setting Access Domain Names (CDN/Global Acceleration)

PDF
Focus Mode
Font Size
Last updated: 2024-01-23 17:15:08

Overview

This document describes how to request COS service using a domain/endpoint other than default COS endpoints.

SDK API Reference

For the parameters and method descriptions of all the APIs in the SDK, please see SDK API Reference.

Default CDN Acceleration Domain Name

The sample code below shows how to access COS service using a default CDN acceleration domain name.

Sample code

Objective-C
QCloudCOSXMLEndPoint *endpoint = [[QCloudCOSXMLEndPoint alloc] init];
endpoint.suffix = @"file.myqcloud.com";
Note:
For the complete sample, go to GitHub.
Swift
let endpoint = QCloudCOSXMLEndPoint();
endpoint.suffix = "file.myqcloud.com";
Note:
For the complete sample, go to GitHub.

Custom CDN Acceleration Domain Name

The sample code below shows how to access COS service using a custom CDN acceleration domain name.

Sample code

Objective-C
QCloudCOSXMLEndPoint *endpoint = [[QCloudCOSXMLEndPoint alloc] initWithLiteralURL:[NSURL URLWithString:@"exampledomain.com"]];
Note:
For the complete sample, go to GitHub.
Swift
let endpoint = QCloudCOSXMLEndPoint.init(literalURL: NSURL.init(string: "exampledomain.com") as URL?);
Note:
For the complete sample, go to GitHub.

Custom Endpoint

For more information, see Enabling Custom Endpoints.
The sample code below shows how to access COS service using a custom endpoint.

Sample code

Objective-C
NSString *customDomain = @"exampledomain.com"; // Custom endpoint
QCloudCOSXMLEndPoint *endpoint = [[QCloudCOSXMLEndPoint alloc] initWithLiteralURL:[NSURL URLWithString:customDomain]];
Note:
For the complete sample, go to GitHub.
Swift
let endpoint = QCloudCOSXMLEndPoint.init(literalURL: NSURL.init(string: "exampledomain.com") as URL?);
Note:
For the complete sample, go to GitHub.

Global Acceleration Endpoint

For more information on global acceleration, see Overview.
The sample code below shows how to access COS service using a global acceleration endpoint.

Sample code

Objective-C
QCloudCOSXMLEndPoint *endpoint = [[QCloudCOSXMLEndPoint alloc]init];
endpoint.suffix = @"cos.accelerate.myqcloud.com";
Note:
For the complete sample, go to GitHub.
Swift
let endpoint = QCloudCOSXMLEndPoint();
endpoint.suffix = "cos.accelerate.myqcloud.com";
Note:
For the complete sample, go to GitHub.

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback