Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I ended up sending the <code>downloadFile:toDirectory:fromServer:</code> message inside a <code>dispatch_async</code> block. I've also created an FTPManage for every file downloaded.</p> <p>It worked, but I have no idea why.</p> <p>I'm leaving this answer to whomever crosses with this problem.</p> <p>If anyone can let me know why this technique worked, please comment bellow so I can update the answer.</p> <p>Here's the new way I'm downloading each file:</p> <pre><code>dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ FTPManager *manager = [[FTPManager alloc] init]; [manager downloadFile:name toDirectory:[NSURL fileURLWithPath:path] fromServer:server]; }); </code></pre> <p>Again, If you know why this worked, let me know.</p> <p>Thanks.</p> <p><strong>Full Method</strong></p> <pre><code>- (void) downloadFTPFiles:(NSString*) basePath { NSLog(@"Reading contents of path: %@", basePath); FMServer *server = [FMServer serverWithDestination:basePath username:@"test" password:@"test"]; NSArray *serverData = [self.ftpManager contentsOfServer:server]; NSLog(@"Number of items: %d", serverData.count); for(int i=0; i &lt; serverData.count; i++) { NSDictionary *sDataI = serverData[i]; NSString *name = [sDataI objectForKey:(id)kCFFTPResourceName]; NSNumber *type = [sDataI objectForKey:(id)kCFFTPResourceType]; if([type intValue] == 4) { NSLog(@"%@ is Folder", name); NSString *nextDestination = [basePath stringByAppendingPathComponent:name]; [self downloadFTPFiles:nextDestination]; } else { NSLog(@"%@ is File", name); dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ FTPManager *manager = [[FTPManager alloc] init]; [manager downloadFile:name toDirectory:[NSURL fileURLWithPath:path] fromServer:server]; }); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload