我有一个下载 PDF 的杂志应用程序,它在iOS 7/Library/Caches/...
上运行得很好,但是从iOS 8(更改文件系统目录)我无法打开下载的 PDF!从日志错误我看到:PSPDFKit
文件下载路径:
/Users/steven/Library/Developer/CoreSimulator/Devices/xxxxx/data/Containers/Data/Application/xxxxx/Library/Caches/doc1.pdf
PSPDFkit 从路径错误中设置文档:
Error: -[PSPDFGlobalLock documentProviderForDocument:page:]/248 Cannot get document reference, there is no file at /Users/steven/Library/Developer/CoreSimulator/Devices/xxxxx/data/Containers/Bundle/Application/xxxxx/[NAMEAPP]/Users/steven/Library/Developer/CoreSimulator/Devices/xxxxx/data/Containers/Data/Application/xxxx/Library/Caches/doc1.pdf!
注意:我已经用xxxx替换了一些单词
我使用的是旧版本PSPDFKit
(我不知道确切的版本,我找不到版本参数)
我以这种方式获取“缓存”文件夹(在我的代码中称为 [实用程序文档]):
NSArray *paths = [[NSArray alloc] initWithArray:NSSearchPathForDirectoriesInDomains( NSCachesDirectory, NSUserDomainMask, YES )];
return [paths objectAtIndex:0];
下载路径PDF代码:
NSString *destPath = [[Utility documents] stringByAppendingPathComponent:[[highlightedMagazine objectForKey:@"url"] lastPathComponent]];
阅读 iOS 8 的 PDF 代码:
NSString *destPath = [[Utility documents] stringByAppendingPathComponent:[[highlightedMagazine objectForKey:@"url"] lastPathComponent]];
pdfController.document = (PSPDFDocument *)[[Utility documents] stringByAppendingPathComponent:[[highlightedMagazine objectForKey:@"url"] lastPathComponent]];
我还看到下载路径"/data/Containers/Data"
和读取路径是"/data/Containers/Bundle"
,我无法更改它。
有人能帮我吗??谢谢!