cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox 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: 

Sync API and caching

Sync API and caching

Mohammed E.
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

Mohammed E.
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.

Greg-DB
Dropbox Staff

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

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Mohammed E. New member | Level 1
What do Dropbox user levels mean?