We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
Jon B.1
3 months agoCollaborator | Level 9
Offline files not downloaded when accessed programmatically (macOS)
Not sure where best to address this question, but it would appear to be API-related...
We've got an existing app which has been working OK until recently on both Windows and Mac platforms, which accesses XML files stored in the user's local Dropbox folder. (The app is mainly cross-platform C++ with a thin layer of platform-specific code, which on the Mac side is Swift-based.) Until now, this has worked fine; while we use SwiftyDropbox on the Mac side for other communication with Dropbox, we haven't had to download the files through the API, we've relied on the Dropbox client app for that.
But now a user, having done a clean install on a Mac, is reporting that the files are showing up as zero bytes; this would appear to be because they're arriving from the shared Dropbox folder and have not been synced locally for offline access, which I understand is the new default behaviour (though I note that the user is not yet running the FileProvider version of Mac Dropbox).
The concern is that, while clicking on the file in Finder in the local Dropbox folder to open it triggers a sync and successfully opens the file... opening the file from within our C++ code doesn't. When we try to read it using standard ifstream and ostringstream calls, we get an empty buffer.
Once we double-click the file in Finder, it reads it correctly (without even restarting our app). And the open calls still work fine with the same version of the Dropbox client on other machines, with files which are synced locally.
So question #1 is, what do we need to do to open the file inside our program the same way as double-clicking in Finder? That would seem to be the simplest way to make the problem go away. (We could do this in either the C++ or Swift code as needed.)
Question #2 is, is there any way to force these XML files *programmatically* to be available offline? Again, that would pre-empt the whole problem. Is there anything in the SwiftyDropboxAPI which can set a file to be synced locally?
Failing that, our least-preferred solution is to download the XML file as a file through SwiftyDropbox, bypassing the local sync directory, and reading it like that. This would require a wider-scale re-engineering of our app, so we'd rather not do that at this point if we can help us.
Which raises question #3 -- is this an issue which can be fixed by having the user upgrade to the FileProvider version? Will that resolve those kinds of sync issues? They're currently using client version 206.4.6506 on Sonoma 14.6.1; are there known issues there?
(For the record, there seems to be something flaky about their Dropbox installation to begin with; the Dropbox shortcut link in the left-hand pane of the Finder window isn't showing the Dropbox icon, and there are no sync icons. I've suggested a reinstall, and will update as we get more information.
- DBoxTipsExperienced | Level 11Hello,
Would it work for you to right-click the Dropbox folder and pick the “Make available offline” option from the Dropbox context menu and from the Dropbox preferences to set new files to sync as offline?
That would allow you to keep the existing app architecture.
Hope this helps,
Andrew (DBoxTips)- Jon B.1Collaborator | Level 9
We can do that in this case, but if possible we'd rather not force all Mac users to sync everything locally, so it would be better to automate it! Thanks, though.
- ЗдравкоLegendary | Level 20
Hi Jon B.1,
Your issue is just one symptom of a bigger problem related to Dropbox application. It's not something related to Dropbox API. Unfortunately, the application' developers are too lazy, as it seems, to prepare and publish documentation for the application exported features. 🤷 That's it.
One way you may try to workaround the issue is open desired files with a pre-built system dialog. They are usually components of corresponding system file manager (Finder, Windows File explorer, etc) and behave in the same way. So likely they will trigger sync of the corresponding file in Dropbox folder. Try at least.
Good luck.
- Greg-DBDropbox Staff
1. This is more of a local filesystem interaction, so I can't offer much guidance here unfortunately, as I can only offer help with the Dropbox API itself. If you want to open a ticket though and reference this thread, we can direct your ticket to the relevant department to see if they can offer some guidance on that, though I can't make any guarantees.
2. The official Dropbox API/SDK does not offer an interface for managing the online/offline setting for files on the desktop, but I'll pass this along as a feature request. I can't promise if or when that might be implemented though.
3. This may be something for the user to directly contact support about.
- Jon B.1Collaborator | Level 9
I've opened a ticket (Ticket #24206378) and am waiting for followup!
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,876 PostsLatest Activity: 6 hours agoIf 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 or Facebook.
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!