I'm using the following code to get a directory listing for an ftp app. It works as expected in iOS, but in macOS, I get no results - data.length is always 0 - and no errors. I've also tried using Session and Task delegates, but get the same results.
Any suggestions?
The format of the ftpURL is "ftp://server.host.net/Public"
Note that I can use the CFFTP methods to get a directory listing, and they do work, but... they are deprecated. Also, the NSURLSession download tasks are working just fine.
- (void)directoryListing:(NSURL *)ftpURL
{
NSLog(@"Directory listing for:\n%@", ftpURL.absoluteString);
NSURLSessionDataTask *dataTask = [[NSURLSession sharedSession] dataTaskWithURL:ftpURL completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error != nil) {
NSLog(@"Client-Error:%@",error.localizedDescription);
} else {
NSString *results = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSLog(@"Data length: %ld, [%@]", data.length, results);
}
}];
[dataTask resume];
}