次を使用して、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
誰かがこれを行う方法を知っているなら私を助けてください。