First you need the official Dropbox iOS SDK. Then you need the application key, which you can get on the Dropbox website (select MyApps). You'll notice that the Dropbox iOS SDK comes with the included demo app, so take a look there. In addition, a good basic tutorial can be found here .
To access the file, your code would look something like this:
NSString* consumerKey; //fill your key NSString* consumerSecret ; //fill your secret DBSession* session = [[DBSession alloc] initWithConsumerKey:consumerKey consumerSecret:consumerSecret]; session.delegate = self; [DBSession setSharedSession:session]; [session release]; if (![[DBSession sharedSession] isLinked]) { DBLoginController* controller = [[DBLoginController new] autorelease]; controller.delegate = self; [controller presentFromController:self]; } DBRestClient *rc = [[DBRestClient alloc] initWithSession:[DBSession sharedSession]]; self.restClient = rc; [rc release]; self.restClient.delegate = self; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"SampleFile.txt"]; [self.restClient loadFile:@"/example/SampleFile.txt" intoPath:filePath];
Please note that iOS Dropbox SDK requires iOS 4.2 or higher.
source share