TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | Custom |
ReleasedLast Release | Dec 2014 |
Maintained by Nikolaj Schumacher.
Getting Started Using the DropboxSDK for OSX:
Requirements: 1. You need Xcode version 5.1 or later. 2. You need to have registered your app at https://dropbox.com/developers/apps You should have an app key and secret.
Note: The SDK is designed to work with OSX versions 10.7 and above.
Building and using the example app: 1. Open the project file in examples/DBRouletteOSX/DBRouletteOSX.xcodeproj 2. Fill in the values for appKey, appSecret, and root in AppDelegate.m applicationDidFinishLaunching: 3. Right click on DBRouletteOSX-Info.plist in the file browser and select "Open As" -> "Source Code". Substitute APP_KEY with your app key in the file. 4. Build and Run app 5. Once running, make sure you can use the app to login and view photos without getting errors. The sample app will look inside your Dropbox's Photos folder if you have full Dropbox access or in your app's App folder if you have App folder access.
If you cannot run the app without getting errors, make sure your app key and app secret are correct.
Adding DropboxOSX framework to your project: Before you can use the Dropbox API in your app, you'll need to add the framework to your project.
Authentication: Now that you've added the framework, the next step is to authenticate which will allow you to make requests against the Dropbox API.
Set the shared DBSession object. To do this, create a DBSession object using the -[DBSession initWithAppKey:appSecret:root:] constructor in your AppDelegates applicationDidFinishLaunching: method. You will need to fill in the appropriate values of app key, secret and root for your app found at https://dropbox.com/developers/apps.
Once you've created the session, you can set it as the shared session using +[DBSession setSharedSession]. Also make sure you're importing the SDK:
Integrate DBAuthHelperOSX into the controller where the user links his Dropbox account (This is done in AppDelegate.m in the example app DBRouletteOSX). This involves three things:
Before you use the auth helper (such as when the controller is created), you need to subscribe to the DBAuthHelperOSXStateChangedNotification like this: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(authHelperStateChangedNotification:) name:DBAuthHelperOSXStateChangedNotification object:[DBAuthHelperOSX sharedHelper]];
In your authHelperStateChangedNotification: method you should update the state of your linked status. Look at -[AppDelegate authHelperStateChangedNotification:] in DBRouletteOSX for an example.
Once you get a DBAuthHelperOSXStateChangedNotification and [[DBSession sharedSession] isLinked] is YES you're ready to start making API calls.
Loading Files and Folders: For more information on how to make calls using the API, check out our tutorial online at https://dropbox.com/developers/start/files#ios for iOS. Once you're authenticated the iOS and OS X SDKs are the same.