ghiboz
ghiboz

Reputation: 8003

ios read content from private network address

I need to read a file that come for example:

\\192.168.0.1\Folder\Readme.txt

how can I read this file from my app into the iPhone

Upvotes: 0

Views: 1623

Answers (3)

mja
mja

Reputation: 5066

As you suggest in your question, you need to access your file over SMB protocol (samba or windows share). I don't think iOS supports smb out of the box, however, i stumbled across tango library on github some time ago. The library claims to be a SMB/CIFS implementation for iOS, so i guess you might give it a try.

Upvotes: 1

chewy
chewy

Reputation: 8267

NSString *pathToTextFile;
NSError  *readError;
NSString *fileData = [NSString stringWithContentsOfFile:pathToTextFile
                               encoding:NSUTF8StringEncoding
                               error:*readError]

 NSLog(@"here is your file as string = %@",fileData);

Upvotes: 1

Max
Max

Reputation: 989

I think in this case you can use a library like ASIHTTP. Link

It should be possible to download the file into a NSString object, and then store this object into a file.

[nsStringObject writeToFile:pathToFile atomically:YES encoding:stringEncoding error:errorHandler];

Upvotes: 1

Related Questions