Using Dropbox v2 from Objective-C


I love Dropbox, it’s a great service that I use every day. They also have a great developer platform that enables folks to build cool things. Late last year Dropbox released the second version of its API, which came along with several client libraries. In a bold move, Dropbox’s client library for iOS was written in Swift instead of Objective-C like their v1 library was. Furthermore, their Swift client library was written in a way that’s actually incompatible with Objective-C, making it challenging for a lot of existing apps using the v1 library to adopt.
Many developers are unhappy with this decision, as there’s not a clear path to upgrade from v1 to v2 that doesn’t involve rewriting an app in Swift or adding a Swift-to-Obj-C compatibility layer. My app, Close-up, has used the Dropbox v1 API since 2013 to implement sync. When the v2 API was announced, I ignored the news for the most part because the v1 API was still supported. However, now it seems like Dropbox may be moving to deprecate the v1 API.
A couple weeks back I decided to start writing an Objective-C Dropbox v2 client library to use in Close-up, and I’m proud to announce today that I’m open sourcing that library. It’s named TJDropbox, you can check it out here!
Currently, TJDropbox can do the following things:
- Migrate v1 tokens to v2 tokens (Allows developers to upgrade from the v1 Dropbox SDK to TJDropbox)
- Authenticate users (Provides built in auth view controller, though you can use SFSafariViewController or roll your own)
- List the contents of a directory
- Download files
- Upload files
- Delete files
- Fetch shareable links to files
In addition to this basic functionality, there are formatters for new requests to Dropbox’s API and handlers for their responses. This makes it easy to add support for other endpoints. This is explained in more detail in the project’s documentation.
I’ve used this as a complete replacement for the old Dropbox SDK in Close-up. The app’s sync engine now communicates with Dropbox via TJDropbox.


I’m beta testing the new version of the app now, and plan to release it in a few weeks. If you’re looking for a way to adopt Dropbox’s new API and want to stick with Objective-C, I’d recommend trying TJDropbox!