【发布时间】:2011-10-28 01:45:29
【问题描述】:
我正在尝试获取位于 NSTemporaryDirectory 文件夹中的名为“temp.pdf”的文件的文件路径(我已检查,该文件存在)。
我用这个:
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。
如何访问文件路径?
【问题讨论】:
标签: objective-c ios cocoa nsbundle