Scott Sarnikowski
Scott Sarnikowski

Reputation: 1489

NSURL to access files on network share in Cocoa - Mac OS X

I am trying to write a small Mac command line app that can read and write XML files to a server on my local network. I have tried creating an NSURL like this:

NSURL *urlToFileOnServer = [NSURL fileURLWithPath:@"/Volumes/{name of folder}/{etc...}/file.xml" isDirectory:NO];

And then I check its existence with:

[urlToFileOnServer checkResourceIsReachableAndReturnError:&err]

but it always responds with file not found (I have confirmed that the file is there as seen by the finder).

Any ideas on what I am doing wrong with the URL? I am hoping that once I get the URL right I can use NSFileHandle to write to it. BTW... The file is on a MacMini running OS X server that I am accessing over WiFi.

Thanks!

Upvotes: 0

Views: 814

Answers (1)

Nathan Kinsinger
Nathan Kinsinger

Reputation: 25041

You are forgetting the volume name: @"/Volumes/{volume name}/{name of folder}/{etc...}/file.xml"

Upvotes: 1

Related Questions