【发布时间】:2014-07-20 04:02:06
【问题描述】:
嗨,在我的应用程序中,我可以选择下载我搜索过的 pdf 文件,我得到了在我的 mac 中使用它的代码,我可以看到下载的 pdf 文件。但问题是,如果我在设备中下载相同的 pdf,我可以在设备中找到下载的 pdf 文件。
这是我用来下载 pdf 文件的代码。
NSData *pdfData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://jesusredeems.com/mag/pdf/JRE-2014-03.pdf"]]; //Store the Data locally as PDF File
NSString *resourceDocPath = [[NSString alloc] initWithString:[[[[NSBundle mainBundle] resourcePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"Documents"]];
NSString *filePath = [resourceDocPath stringByAppendingPathComponent:@"11011.pdf"]; [pdfData writeToFile:filePath atomically:YES]; NSLog(@"%@",filePath);
如果我打印文件路径,我会得到这样的结果。
/var/mobile/Applications/353C27AD-1E64-41CA-A429-16C2A20C8606/Documents/11011.pdf
在我的 Mac 中,我可以在该路径中看到下载的文件,但在我的 Ipad 中,我可以看到下载的 pdf 文件,请任何人告诉我必须在哪里找到它。
谢谢。
【问题讨论】: