Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
vanya e.
9 years agoNew member | Level 1
Cache files properly with Core API for iOS and Swift
Hello!
I'm now working on the simple Dropbox viewer application.
Currently I'm using "download to Documents folder" method like that:
if let data = NSData(contentsOfFile: destinationPath) {
print("File already cached")
} else {
print("File not cached, processing cache operation...")
Manager.client.loadFile(filePath, intoPath: destinationPath)
}
Files are downloading properly, but, I think, that it's a wrong way to cache files.
So, the question is: is there a way to cache images with standard API tools and, for example, store them with NSCache or something similar?
P.S. It's not essentially important, actually, in which programming language will be answer, I'm simply trying to understand the principles, if they exist
Thanks!
1 Reply
Replies have been turned off for this discussion
- Greg-DB9 years ago
Dropbox Community Moderator
The Dropbox API and SDK themselves don't offer local caching like this, so you will need to implement it in your app's code if your app needs caching. Actual caching strategies and algorithms are beyond the scope of just Dropbox/Dropbox API support, so I can't offer much help with that in general. Perhaps someone here can offer some advice or direct you to some good resources though.
One thing I will note specific to Dropbox though, is to check the rev for the value. The remote Dropbox file could have changed after you originally downloaded it, meaning the copy you have locally is out of date.
About 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!