This is how i changed my code.
- (void)restClient:(DBRestClient *)client loadedMetadata:(DBMetadata *)metadata
{
dropBoxArray=[[NSMutableArray alloc]init];
for (DBMetadata* child in metadata.contents)
{
if (child.isDirectory)
{
[client loadMetadata:child.path withHash:nil];
}
else
{
[dropBoxArray addObject:child.path];
jscallback=[NSString stringWithFormat:@"getFilename(%@)",dropBoxArray];
[self.webView stringByEvaluatingJavaScriptFromString:jscallback];
}
}
NSLog(@"path%@",dropBoxArray);
}
//method called from the javascript to display the files.
-(void)getfiles:(CDVInvokedUrlCommand *)command
{
CDVPluginResult* pluginResult = nil;
[self.restClient loadMetadata:@"/" withHash:nil];
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
self.restoreJavaScript = [pluginResult toSuccessCallbackString:command.callbackId];
}