This document describes how to request COS service using a domain/endpoint other than default COS endpoints.
For the parameters and method descriptions of all the APIs in the SDK, please see SDK API Reference.
For more information, see Enabling Default CDN Acceleration Domain Names.
The sample code below shows how to access COS service using a default CDN acceleration domain name.
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.
For more information, see Enabling Custom CDN Acceleration Domain Names.
The sample code below shows how to access COS service using a custom CDN acceleration domain name.
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.
For more information, see Enabling Custom Endpoints.
The sample code below shows how to access COS service using a custom endpoint.
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.
For more information on global acceleration, see Overview.
The sample code below shows how to access COS service using a global acceleration endpoint.
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.
Was this page helpful?