Your workflow is unique 👨‍💻 -  tell us how you use Dropbox here.

Forum Discussion

Mohammed E.'s avatar
Mohammed E.
New member | Level 1
11 years ago

Sync API and caching

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

Replies have been turned off for this discussion
  • Mohammed E.'s avatar
    Mohammed E.
    New member | Level 1
    11 years ago

    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's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    11 years ago

    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

About Dropbox API Support and Feedback

Node avatar for Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.

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!