I have this code here:
NSString *stringURL = @"\\\\SERVER\\FOLDER\\FOLDER\\FTP\\ANC\\ANC.pdf"; NSURL *url = [NSURL fileURLWithPath:stringURL]; NSData *urlData = [NSData dataWithContentsOfURL:url];
but urlData returned nill
I tried datawithcontentsoffile, but I got a warning when using the url variable with it.
When I go to this file url: //SERVER/FOLDER/FOLDER/FTP/ANC.pdf on Windows, it opens the file, but on mac it is not.
I also tried the following:
NSString *stringURL = @"file://SERVER/FOLDER/FOLDER/FTP/ANC.pdf"; NSURLSession *session = [NSURLSession sharedSession]; [[session dataTaskWithURL:[NSURL URLWithString:stringURL] completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
but get the following errors:
NSErrorFallingURLStringKey NSErrorFallingURLKey NSLocalizedDescription NSUnderlyingError
UPDATE I can get a URL that does not return nill with the following:
NSURL *url = [NSURL fileURLWithPath:@"file:///server/FOLDER/FOLDER/FTP/ANC/ANC.pdf"];
however, this returns nill:
NSData *urlData = [NSData dataWithContentsOfURL:url];
I added an error: dataWithContentsoFURL
and he returned it:
connectionError NSError * domain: @"NSCocoaErrorDomain" - code: 260 0x166d8af0
I looked at this file via Get Info and it starts as follows smb://server/folder/folder/ANC/ANC.pdf