我想获取名为"temp.pdf"的文件在NSTemporaryDirectory文件夹中的路径(我已经检查过,该文件存在)。
我使用以下代码:
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"temp" ofType:@"pdf" inDirectory:NSTemporaryDirectory()];
我已经尝试过:
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"temp.pdf" ofType:@"" inDirectory:NSTemporaryDirectory()];
而且:
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"temp" ofType:@"pdf"];
但是似乎它不起作用,返回值始终为null。
我如何访问文件路径?
NSURL *furl = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"temp.pdf"]];
这行代码。 - Joe