Forum Discussion

Cotin Yang's avatar
Cotin Yang
Explorer | Level 4
5 years ago

Upload large file with Objective-C SDK always failed

Hi 

    I used the method below to upload large files under MacOS BigSur

- (DBBatchUploadTask *)batchUploadFiles:(NSDictionary<NSURL *, DBFILESCommitInfo *> *)fileUrlsToCommitInfo
                                  queue:(nullable NSOperationQueue *)queue
                          progressBlock:(DBProgressBlock _Nullable)progressBlock
                          responseBlock:(DBBatchUploadResponseBlock)responseBlock;

    After 10MB data uploaded(which printed in progressBlock), responseBlock will return errors:

Printing description of fileUrlsToRequestErrors:
{
    "file:///Users/cotin_yang/Public/bug/2.zip" = "DropboxClientError[{\n    NSError = \"Error Domain=NSURLErrorDomain Code=-1001 \\\"The request timed out.\\\" UserInfo={_kCFStreamErrorCodeKey=-2102, NSUnderlyingError=0x600000ebce40 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 \\\"(null)\\\" UserInfo={_kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalUploadTask <A49A3902-E076-45F4-99E9-80FA12AC7296>.<2>, _NSURLErrorRelatedURLSessionTaskErrorKey=(\\n    \\\"LocalUploadTask <A49A3902-E076-45F4-99E9-80FA12AC7296>.<2>\\\"\\n), NSLocalizedDescription=The request timed out., NSErrorFailingURLStringKey=https://api-content.dropbox.com/2/files/upload_session/append_v2, NSErrorFailingURLKey=https://api-content.dropbox.com/2/files/upload_session/append_v2, _kCFStreamErrorDomainKey=4}\";\n}];";
}
Printing description of ((DBFILESUploadSessionFinishBatchResultEntry *)0x0000600000131200):
{
    ".tag" = failure;
    failure =     {
        ".tag" = "lookup_failed";
        "lookup_failed" =         {
            ".tag" = "incorrect_offset";
            "correct_offset" = 10485760;
        };
    };
}

    It seems the uploading process was failed in calling the API "upload_session/append_v2". But the method "batchUploadFiles" has no parameter to set offset.

   Please help me fix this.

   Thanks

 

 

 

 

 

1 Reply

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    5 years ago

    To clarify, are you able to reliably reproduce this issue every time you try? It appears this occurred due to a network issue, so I wouldn't expect that to re-occur each time. (If it does though, let us know as that may indicate a bug in the SDK.)

     

    Anyway, it looks like a network timeout caused the client and server to get out of sync. The batchUploadFiles method doesn't offer a way to recover from that (or do so automatically), so you'd need to retry the upload entirely (e.g., using batchUploadFiles again) for the failed file(s). 

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!