cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Are you interested in hearing how one of our Community members uses Dropbox for sailing trips? Read all about it here.

Discuss Dropbox Developer & API

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

Swift IOS upload large files when app is in background

Swift IOS upload large files when app is in background

ballerapp
New member | Level 2

Is there any way we can upload large files when app is in background using SwifyDropBox? If not then how can we achieve this using NSURLSESSION in swift and DropBox HTTP Requests?

8 Replies 8

Greg-DB
Dropbox Staff

SwiftyDropbox does not currently support background uploads, but I'll pass this along as a feature request. I can't promise if or when that might be implemented though.

 

If you want to implement your own uploading code outside of SwiftyDropbox, you can do so using the HTTP endpoints. In particular, for uploading large (greater than 150 MB) files, you'll need to use the upload sessions functionality.

Greg-DB
Dropbox Staff

We've released a beta version of SwiftyDropbox with some significant updates, such as support for background sessions. You can find more information here: https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Beta-version-of-major-SwiftyDropbox-upd...

Greg-DB
Dropbox Staff

The beta mentioned above has been promoted to stable release. Read more about it here: https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Major-SwiftyDropbox-update-available/td...

dsmurfin
Explorer | Level 3
Hi Greg,

I’m intrigued as to how to use the new background functionality with large files using an upload session in SwiftyDropbox.

The API for upload sessions is to provide a Data, but crashes when using a background client with the message:

'Upload tasks from NSData are not supported in background sessions.'

Any thoughts?

Greg-DB
Dropbox Staff

@dsmurfin The SwiftyDropbox methods for uploading files accept file data as Data, URL, or InputStream. For example, here's the three versions of the "upload" method:

Can you try URL or InputStream instead and see if that works for you?

dsmurfin
Explorer | Level 3
Hi Greg,

So my problem here is these are all for files < 150 MB which is well short of what I need. So I have to use an upload session which only supports provision of Data.

If the API for session allowed URLs to be provided I could chunk up my large file into tiny ones to present but it doesn’t offer that.

Thanks

Greg-DB
Dropbox Staff

@dsmurfin The examples I included in my previous message happened to be for the (non-upload session) "upload" method, but the upload session methods also support the same three ways of supplying file contents. For instance, here are the three versions of the uploadSessionStart method:

dsmurfin
Explorer | Level 3
Thank you! I totally missed this when looking at the API. I expect this will solve my issue, thanks!
Need more support?
Who's talking

Top contributors to this post

  • User avatar
    dsmurfin Explorer | Level 3
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?