Problem description
The message "The resource is uploaded successfully" is displayed when you use the IOS SDK to upload OSS resources. However, the uploaded resources cannot be obtained in the OSS console.
Cause
During wireless network environment, it takes a long time to upload a large file. The upload may fail due to poor network connectivity or network switches. As a result, the entire file needs to be uploaded again.
Solution
You can use the following methods to optimize the upload operation.
Resumable upload
We recommend that you use resumable Upload to upload files due to unstable network conditions.
Set the Network timeout period and retry times
For mobile application, edit the following code in the IOS SDK to configure the Network timeout period and retry times.
OSSClientConfiguration * conf = [OSSClientConfiguration new];
conf.maxRetryCount = 3; // The number of retry attempts after the network request fails due to exceptions.
conf.timeoutIntervalForRequest = 30; // The timeout period of a network request.Set Content-Type and MD5
Set Content-Type and enable MD5 verification. If the verification fails, upload the resource again.
Check CRC-64 value
Errors may occur when data is transmitted between the client and the server, OSS allows the client to return the crc64 value of the Object uploaded by using any of the methods. The client can compare the crc64 value with the locally calculated value to verify data integrity. For more information, see Check data integrity by using CRC-64.
Enable logging
The OSS log feature allows you to easily locate problems that occur when you upload resources.
The operating environment of your mobile client is complex. The OSS SDK may be unavailable in some regions or in a certain period of time. To further locate problems developers encounter, the OSS SDK records log entry locally after the log feature is enabled. Initialize the client and call the following methods to enable log entry:
Caches in the sandbox or in the OSSLogs folder.
You can optionally upload files to the server to further track problems.
Application scope
OSS