QCloudGetPresignedURLRequest* getPresignedURLRequest = [[QCloudGetPresignedURLRequest alloc] init];// Generate an unsigned URLgetPresignedURLRequest.isUseSignature = false:// Bucket name in the format of BucketName-Appid, which can be viewed in the COS console at https://console.tencentcloud.com/cos5/bucketgetPresignedURLRequest.bucket = @"examplebucket-1250000000";// Object key, i.e. the full path of a COS object. If the object is in a directory, the path should be "video/xxx/movie.mp4"getPresignedURLRequest.object = @"exampleobject";[getPresignedURLRequest setFinishBlock:^(QCloudGetPresignedURLResult * _Nonnull result,NSError * _Nonnull error) {// Pre-Signed URLNSString* presignedURL = result.presienedURL;}];[[QCloudCOSXMLService defaultCOSXML] getPresignedURL:getPresignedURLRequest];
let getPresign = QCloudGetPresignedURLRequest.init();// Generate an unsigned URLgetPresign.isUseSignature = false;// Bucket name in the format of BucketName-Appid, which can be viewed in the COS console at https://console.tencentcloud.com/cos5/bucketgetPresign.bucket = "examplebucket-1250000000" ;// Object key, i.e. the full path of a COS object. If the object is in a directory, the path should be "video/xxx/movie.mp4"getPresign.object = "exampleobject";getPresign.setFinish { (result, error) inif let result = result {let url = result.presienedURL} else {print(error!);}}QCloudCOSXMLService.defaultCOSXML().getPresignedURL(getPresign);
Feedback