Home

Awesome

TJDropbox

TJDropbox is a Dropbox v2 client library written in Objective-C. When Dropbox originally announced their v2 API they included only a Swift client library, and at the time I wrote TJDropbox as an Objective-C alternative to it to migrate my app Close-up to Dropbox v2. Since then, Dropbox has released an Objective-C v2 SDK. If you’re migrating away from Dropbox’s v1 SDK to v2 and are considering alternatives to Dropbox’s first party solution, TJDropbox is a pretty well featured replacement with no dependencies and very few source files.

Installation

You can use TJDropbox by adding all the source files from the TJDropbox/ directory to your project, or with CocoaPods.

<a name="auth">Authenticating</a>

Authentication with TJDropbox is pretty flexible. The simplest way to do it would be to use the provided TJDropboxAuthenticator class.

- (void)authenticate
{
    [TJDropboxAuthenticator authenticateWithClientIdentifier:/*Dropbox client identifier*/
                                         options:/*Options for auth*/
                                                  completion:^(TJDropboxCredential *credential) {
        if (credential) {
            // Auth succeeded, store credential.
        } else {
            // Auth did not succeed.
        }
    }];
}

Be sure to call +tryHandleAuthenticationCallbackWithURL: from your app delegate's -application:openURL:options: method for this to work. TJDropboxAuthenticator attempts auth using the following methods in order of preference.

  1. The Dropbox app (bypassed if bypassNativeAuth is YES in options)
  2. ASWebAuthenticationSession in iOS 12+.
  3. SFAuthenticationSession in iOS 11+.
  4. Auth in Safari.app

That being said, you can also authenticate manually using the utility methods TJDropbox provides. Advanced auth is detailed here.

TJDropbox doesn't store the credentials, that's up to you.

Provided Request Types

Once authenticated, TJDropbox is capable of doing the following things

The methods for these are all listed in TJDropbox.h.

Custom Requests

Though TJDropbox only supports a few types of requests for now, internally it has formatters for any Dropbox API request you'd like and handlers for parsing results. Most notably:

All the externally exposed methods in TJDropbox are built on top of these utilities, and they can be used to add new functionality to TJDropbox. Requests and pull requests are very welcome!

Architecture notes

Todo

Apps using TJDropbox