On mobile networks, the iOS SDK can report a successful upload even when the upload silently failed partway through. Poor wireless connectivity or a network switch during a long upload causes the transfer to fail. The object is absent from the OSS console because the full file still needs to be uploaded.
Use the approaches below to make uploads reliable on mobile networks.
Choose the right upload method
Resumable upload splits a file into independently tracked parts. If a part fails, only that part is retried — not the entire file. For large files on mobile networks, this is the recommended upload method.
| Single upload | Resumable upload | |
|---|---|---|
| Best for | Small files on stable networks | Large files or unstable mobile networks |
| On network failure | Must restart the entire upload | Retries only the failed parts |
See Resumable upload in the developer reference.
Configure timeout and retry count
For mobile applications, configure OSSClientConfiguration to control how long a request waits before timing out and how many times it retries on failure:
OSSClientConfiguration * conf = [OSSClientConfiguration new];
conf.maxRetryCount = 3; // Number of retry attempts after the network request fails due to exceptions.
conf.timeoutIntervalForRequest = 30; // Timeout period of a network request, in seconds.Verify upload integrity
Two mechanisms let you confirm that the data OSS received matches what you sent.
Set Content-Type and enable MD5 verification
Set the Content-Type header and enable MD5 verification on the upload request. If the MD5 hash does not match, re-upload the object.
Check the CRC-64 value
OSS returns a CRC-64 checksum for objects uploaded using any of the upload methods. Compare it against the locally calculated CRC-64 value to confirm data integrity.
Enable logging to diagnose upload failures
Two logging options are available for tracking upload issues.
OSS logging feature
The OSS logging feature records upload activity in real time and helps pinpoint where a failure occurred.
OSS SDK local logging
Mobile operating environments are unpredictable — the SDK may be unavailable in certain regions or periods. After enabling local logging, the SDK writes log entries to the device sandbox or the OSSLogs folder. Initialize the client and call the log enable method to activate it. Optionally upload the logs to a server for deeper analysis.