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
The sample code below shows how to access COS service using a custom endpoint.
Sample code
Objective-C
NSString *customDomain = @"exampledomain.com";
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.
Apakah halaman ini membantu?