tencent cloud

Cloud Object Storage

Release Notes and Announcements
Release Notes
Announcements
Product Introduction
Overview
Features
Use Cases
Strengths
Concepts
Regions and Access Endpoints
Specifications and Limits
Service Regions and Service Providers
Billing
Billing Overview
Billing Method
Billable Items
Free Tier
Billing Examples
Viewing and Downloading Bill
Payment Overdue
FAQs
Getting Started
Console
Getting Started with COSBrowser
User Guide
Creating Request
Bucket
Object
Data Management
Batch Operation
Global Acceleration
Monitoring and Alarms
Operations Center
Data Processing
Content Moderation
Smart Toolbox
Data Processing Workflow
Application Integration
User Tools
Tool Overview
Installation and Configuration of Environment
COSBrowser
COSCLI (Beta)
COSCMD
COS Migration
FTP Server
Hadoop
COSDistCp
HDFS TO COS
GooseFS-Lite
Online Tools
Diagnostic Tool
Use Cases
Overview
Access Control and Permission Management
Performance Optimization
Accessing COS with AWS S3 SDK
Data Disaster Recovery and Backup
Domain Name Management Practice
Image Processing
Audio/Video Practices
Workflow
Direct Data Upload
Content Moderation
Data Security
Data Verification
Big Data Practice
COS Cost Optimization Solutions
Using COS in the Third-party Applications
Migration Guide
Migrating Local Data to COS
Migrating Data from Third-Party Cloud Storage Service to COS
Migrating Data from URL to COS
Migrating Data Within COS
Migrating Data Between HDFS and COS
Data Lake Storage
Cloud Native Datalake Storage
Metadata Accelerator
GooseFS
Data Processing
Data Processing Overview
Image Processing
Media Processing
Content Moderation
File Processing Service
File Preview
Troubleshooting
Obtaining RequestId
Slow Upload over Public Network
403 Error for COS Access
Resource Access Error
POST Object Common Exceptions
API Documentation
Introduction
Common Request Headers
Common Response Headers
Error Codes
Request Signature
Action List
Service APIs
Bucket APIs
Object APIs
Batch Operation APIs
Data Processing APIs
Job and Workflow
Content Moderation APIs
Cloud Antivirus API
SDK Documentation
SDK Overview
Preparations
Android SDK
C SDK
C++ SDK
.NET(C#) SDK
Flutter SDK
Go SDK
iOS SDK
Java SDK
JavaScript SDK
Node.js SDK
PHP SDK
Python SDK
React Native SDK
Mini Program SDK
Error Codes
Harmony SDK
Endpoint SDK Quality Optimization
Security and Compliance
Data Disaster Recovery
Data Security
Cloud Access Management
FAQs
Popular Questions
General
Billing
Domain Name Compliance Issues
Bucket Configuration
Domain Names and CDN
Object Operations
Logging and Monitoring
Permission Management
Data Processing
Data Security
Pre-signed URL Issues
SDKs
Tools
APIs
Agreements
Service Level Agreement
Privacy Policy
Data Processing And Security Agreement
Contact Us
Glossary

SDKs

PDF
Focus Mode
Font Size
Last updated: 2024-12-26 16:36:13

Common SDK Issues

What do I do if I upload a file using a file stream/handle, but the uploaded file is truncated or the size is 0?

If the file is uploaded with a file stream/handle, the stream or handle usually contains an offset pointer. If the stream/handle is used before being uploaded, the offset pointer may not point to the starting point of the file. In this case, the SDK uploads the file starting from where the offset points to by default, resulting in the truncated or 0-size file. To solve this problem, you are advised to check the offset, or point the offset to the file’s starting point manually if necessary.

How do I get the object’s URL after it is successfully uploaded?

URLs of objects in COS are formed using a fixed format. For more information, please see Object Overview - Object access address.

What do I do if the system reports that the temporary key expired when I upload files?

Please follow the steps below for troubleshooting:
1. Check whether the time of the machine that runs your applications is correct. If the machine time is incorrect, rectify it.
2. Check whether the expiration time (expirationDate) that you set is earlier than the current time. The current time being later than the expiration time will cause the signature to expire. In that case, you need to change the expiration time and regenerate a temporary key.
3. The iOS SDK uses the QCloudSignatureProvider and QCloudCredentialFenceQueueDelegate protocols during initialization. The QCloudCredentailFenceQueue scaffolding tool will cache and reuse your temporary key. You can update the cache by reinitializing the credentialFenceQueue instance to avoid using a temporary key that has expired. For more information, see Create a COS instance.

How do I determine whether files are successfully uploaded?

In COS, each object corresponds to an ETag value. After a file is successfully uploaded, an ETag value of the String type will be returned and the ETag value is not NULL. You can add a determination condition to determine whether files are successfully uploaded.
Add a Header with a specified referer to your request for an object.

Does generating a pre-signed URL generate network requests and incur fees? Will there be a delay?

Generating a pre-signed URL is local logic and does not generate network requests, causing no additional network latency and no additional cost. You can call the SDK API to generate a pre-signed URL at any time when needed.

How do I configure a custom domain name for a COS pre-signed URL?

A pre-signed URL contains a fixed default domain name, which can be replaced via encoding.

How do I create a directory in COS SDK?

A directory in COS is virtual and is actually an object ending with /. You can call the object upload API to create an object ending with /, which is a directory. For more information, see Mini Program SDK use case: Create a directory.

Why are different results returned when I use the same prefix rule and data structure to obtain ObjectList via COS SDK?

To make it easier for you to get started, COS simulates the display mode of "folder" or "directory" in the console and graphical tools such as COS browser. This is realized by creating an empty object with a key value of project/ and displaying it as a traditional folder. Therefore, the objectList obtained through the SDK will contain empty objects whose object names end with /.

SDK FAQs

Help and Support

Was this page helpful?

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

Feedback