简体   繁体   中英

Loading file from Dropbox

I have been following the dropbox tutorial for the iOS platform. And i came across this line of code to load a file.

[[self restClient] loadFile:dropboxPath intoPath:localPath]

below this line, it has a little description box describing the code above, which states:

Here, srcPath is the path in the user's Dropbox (you probably got this from a metadata object), and destPath is the location on the local device you want the file to be put after it has been downloaded. To find out when the file download either succeeds or fails implement the following DBRestClientDelegate methods:

1) First off, there is no srcPath nor is there a destPath . So the either the code or the description of the code is outdated/incorrect.

2) Secondly, what is dropboxPath ? I am assuming it is the file i want to load from dropbox. If so, how do i specify which file i want?

3) If i am loading a .sqlite file from dropbox, where exactly do i want to load that file into?

Any help would be very appreciated!

1) DropboxPath is the online path where your file is stored in respective Dropbox Account.

2) The source path will be DropboxPath and the destination path will be the path on ur mobile ie Document Directory. All the files should be downloaded to either document directory or inside other directory of document directory.

3) Your .sqlite file should be loaded in document directory only. But the project code should use this file using its NSPath.

Have a happy Coding.!! Enjoy.!!

The dropboxPath will indicate where within your application's Dropbox directory the file is. For instance, if your app is called APP01, then the users's Dropbox login will have an APP01 directory. To get a file from that you would specify it as @"/theFile.txt" and the Dropbox API should get APP01/theFile.txt from the user's account. Dropbox will sandbox your access to the user account when you create your development IDs to connect to them.

The localPath should be in your app's sandbox, which you can get using something like

+ (NSString*) GetDocumentDirectory
{
    NSArray *paths =
    NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    return ((paths != nil) && ([paths count] > 0)) ? [paths objectAtIndex:0] : nil;
}

You can append your local filename to what's returned from GetDocumentDirectory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM