cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Update: Find information on Dropbox support during COVID-19 here
Close

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: 
Highlighted

Sync API and caching

New member | Level 1
New member | Level 1

Hello,

I'm using the sync API to upload and download a drawn image across iOS devices. I've added a file system observer to respond to any file changes. However the API caching of the image seems to be causing issues. The image uploads fine, I can see it updated on Dropbox, I'm getting notified on my other device of the update through the observer, however the DBFile that I open to reference the image contains the old version, even after I use the update function on the DBFile. If I set the file system maxFileCacheSize to 0, then everything is working as expected. Any ideas on what could be wrong?

2 Replies 2
Highlighted

Re: Sync API and caching

New member | Level 1
New member | Level 1

Alright, so I wasn't aware of how update doesn't block until the file downloads, so I added an observer should newerStatus not be nil and once download progress was at 1.0 I called update and surely enough DBFile now references the proper version of the file. Hope this helps someone in the future.

Highlighted

Re: Sync API and caching

Dropboxer
Dropboxer

That's correct, reading a file will always give you any cached content first, not blocking on the download of new content (unless there is no cached copy), so you should use an observer to know when the new content is available and update to it. You can find more information here:

https://www.dropbox.com/developers/sync/start/ios#observers

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?