我可以使用以下方法通过 NSURL 访问我的本地文件:
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"file://localhost/Users/user/Desktop/lucky_numbers.json"]];
但我需要访问另一台 PC 的文件。我试过:
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"file://foyzulkarim:000000@192.168.1.48/localhost/Users/foyzulkarim/Desktop/lucky_numbers.json"]];
和
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"file://192.168.1.48/localhost/Users/foyzulkarim/Desktop/lucky_numbers.json"]];
和
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"file://Foyzul-Karims-MacBook.local/localhost/Users/foyzulkarim/Desktop/lucky_numbers.json"]];
但错误显示NSURLError domain code -1100
如果有人知道如何做到这一点,请帮助我。