Search code examples
iosdropboxdropbox-apidropbox-sdk

Objective-C dropbox SDK migration from API V1 to API V2


Can anyone please help me to list all the files in a dropbox's specific folder using the V2 api, NOT V1.

There is no DBSession class anymore. Then how to let the app know that the user had already authenticated. In the V1 version we used to write something like-

[[DBSession sharedSession] isLinked];

But now we don't have DBSession.

Also we don't have DBRestClientDelegate. So, how can we use loadMetaData: method either. What are the replacement for these methods.

Can anyone please provide some sample code to list and download the files from dropbox using Dropbox SDK version V2.


Solution

  • To check if you have an account connected already, you can use authorizedClient as shown here:

    https://github.com/dropbox/dropbox-sdk-obj-c/blob/master/Examples/DBRoulette/iOS/CocoaPodsProject/DBRoulette/DBRoulette/ViewController.m#L58

    To list the files in a folder, you should use listFolder and listFolderContinue as shown here:

    https://github.com/dropbox/dropbox-sdk-obj-c#rpc-style-request

    To download files, you should use the download methods as shown here:

    https://github.com/dropbox/dropbox-sdk-obj-c#download-style-request