Migrating Dropbox from full access to the Apps folder
I have supported Dropbox in my iOS apps for many years, and they all expect files to be in (or below) the top level folder. More recently, Dropbox added support for apps only being able to access files in a per-app subdirectory of a folder called Apps. This keeps your Dropbox folder nice and tidy.
I plan to update all of my apps to support this newer mode, however it wasn’t obvious how to do the migration (there is very little documentation about how to do it!). This is more of a technical post on my findings and a solution that works for me.
1. First of all, each app is registered with Dropbox, specifically my existing apps are all registered for full access to Dropbox. To support the Apps folder too, you need to register a second version of each app, to give you a second key/secret pair.
2. You need to give each a new name. I simply added (Apps folder) on the end.
3. Choose the name of the subdirectory. This is unique across all apps, so think carefully before choosing. I have simply used my app names as they were not (yet) taken.
In order to support existing users PLUS new ones, my plan was to detect whether the app is already linked to Dropbox, and if so use the old key/secret pair for authentication. If the app is not yet linked, I use the new key/secret pair.
One slight issue is that there is no obvious way to detect which access method is currently being used. Basically the Dropbox APIs don’t tell you. I therefore have to keep track of this myself with a hidden user setting. When the app is first launched, I first try the old method. If it is linked to Dropbox already, I continue to use that. But if not, I switch to using the new method from that point onwards.
The only slight drawback is that users will need to copy their existing files from one folder to another. I will of course document this with each update!
UPDATE: Hill Lists 4.1 now includes this change. My other apps will follow.