Accessing a server side text file Objective-C
-
12-12-2019 - |
Question
I am trying to read a simple text file from a share drive on my internal network.
NSString *filePath = @"/Users/myName/Desktop/App_Data/text.txt";
NSFileManager *filemgr;
filemgr = [NSFileManager defaultManager];
if ([filemgr fileExistsAtPath:filePath] == YES)
NSLog (@"File exists");
else
NSLog (@"File not found");
I have a shortcut to the folder called App_Data on my desktop which is connected to the server but the actual file is on the server and cannot access the file through the shortcut folder. I am trying to do this for an iPad using Objective-C. Is there a better method to access the server?
Solution
Run an FTP server on the machine with the file(s) you want to access and create an FTP connection to that from the iPad.
Here is a "simple" FTP example from Apple, SimpleFTPSample, using both the NSURLConnection and CFFTPStream APIs.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow