cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Back again with another edition of 'How we use Dropbox', so find out how Emma uses to-do lists to get it all done here!

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Upload large file with Objective-C SDK always failed

Upload large file with Objective-C SDK always failed

Cotin Yang
Explorer | Level 4

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 1

Re: Upload large file with Objective-C SDK always failed

Greg-DB
Dropboxer

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). 

Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?