开发者

get access to a file of another PC through NSURL

I can access to my local file through NSURL by using:

    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"file://l开发者_JAVA百科ocalhost/Users/user/Desktop/lucky_numbers.json"]];  

But I need to get access of a file of another PC. I tried:

NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"file://foyzulkarim:000000@192.168.1.48/localhost/Users/foyzulkarim/Desktop/lucky_numbers.json"]];

and

NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"file://192.168.1.48/localhost/Users/foyzulkarim/Desktop/lucky_numbers.json"]];

and

NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"file://Foyzul-Karims-MacBook.local/localhost/Users/foyzulkarim/Desktop/lucky_numbers.json"]];

But Error shows NSURLError domain code -1100

Please help me if anyone knows how to do this.


I doesn't work that way. The file: URI scheme only supports local file access, not remote. For remote access you need a real network protocol like HTTP or FTP and thus a server on the remote site.


You can access to my local file through NSURL by using: NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"file://192.168.1.48/localhost/Volumes/foyzulkarim/Desktop/lucky_numbers.json"]];

but, to do this you have to first connect with that PC manually.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜