When I call the DBRestClient to download a file to a given path, the API does not call the loading functions.
For example:
- (void) downloadFiles:(NSMutableArray *)files
{
NSLog(@"%@", files);
itemsToBeDownloaded = [[NSMutableArray alloc] initWithArray:files];
restClient = [self restClient];
for (NSString *string in files)
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"/Dropbox%@", string]];
[restClient loadFile:string intoPath:filePath];
}
}
Printing files
returns (
"/Blank.pdf"
)
Printing string
returns /Blank.pdf
Printing filePath
returns /var/mobile/Applications/0C506400-7142-41E2-9F3D-0965985CED9E/Documents/Dropbox/Blank.pdf
So the function is called and knows the files and their path's to download.
However, when I call [restClient loadFile:string intoPath:filePath];
, nothing happens. I have the delegate methods in:
- (void) restClient:(DBRestClient *)client loadedFile:(NSString *)destPath
{
NSLog(@"Called!");
}
- (void) restClient:(DBRestClient *)client loadedFile:(NSString *)destPath contentType:(NSString *)contentType
{
NSLog(@"Called!");
}
- (void) restClient:(DBRestClient *)client loadedFile:(NSString *)destPath contentType:(NSString *)contentType metadata:(DBMetadata *)metadata
{
NSLog(@"%@", destPath);
NSLog(@"%@", contentType);
NSLog(@"%@", metadata);
}
- (void) restClient:(DBRestClient *)client loadFileFailedWithError:(NSError *)error
{
NSLog(@"Error downloading file: %@", error);
}
No Called!
statement is produced. It seems the RestClient is not downloading the data.
Another note: restClient = [self restClient];
does return a valid DBRestClient, so I know it is valid. However, the call to load the file is not being called.
Is there a specific reason the call to loadFile:
is not being made? I have it loading Metadata just fine.
EDIT: a call to loadMetadata: at string
does NOT call the loadMetadata delegate method.
EDIT 2: code below lists how the file's array is claimed:
- (void) downloadFiles
{
NSMutableArray *filesToDownload = [[NSMutableArray alloc] init];
for (int i = 0; i < [[itemsToDownload allKeys] count]; ++i)
{
for (NSString *string in [itemsToDownload objectForKey:[[itemsToDownload allKeys] objectAtIndex:i]])
{
[filesToDownload addObject:[NSString stringWithFormat:@"%@%@", [[itemsToDownload allKeys] objectAtIndex:i], string]];
}
}
[dropboxController downloadFiles:filesToDownload];
}