I've a magazine app that downloads PDF in /Library/Caches/...
It works pretty well with iOS 7, but from iOS 8 ( that changes file system directories ) I can't open downloaded PDF! from PSPDFKit
log error I see:
File downloaded path:
/Users/steven/Library/Developer/CoreSimulator/Devices/xxxxx/data/Containers/Data/Application/xxxxx/Library/Caches/doc1.pdf
PSPDFkit set document from path error:
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!
Attention: I've replaced some words with xxxx
I'm using an old version of PSPDFKit
( i don't known exactly version, I can't find version params )
i get "Caches" folder in this way ( called [Utility documents] in my code ):
NSArray *paths = [[NSArray alloc] initWithArray:NSSearchPathForDirectoriesInDomains( NSCachesDirectory, NSUserDomainMask, YES )];
return [paths objectAtIndex:0];
Download path PDF code:
NSString *destPath = [[Utility documents] stringByAppendingPathComponent:[[highlightedMagazine objectForKey:@"url"] lastPathComponent]];
Read PDF code for iOS 8:
NSString *destPath = [[Utility documents] stringByAppendingPathComponent:[[highlightedMagazine objectForKey:@"url"] lastPathComponent]];
pdfController.document = (PSPDFDocument *)[[Utility documents] stringByAppendingPathComponent:[[highlightedMagazine objectForKey:@"url"] lastPathComponent]];
I see also that download path is "/data/Containers/Data"
and read path is "/data/Containers/Bundle"
, I can't change it.
Can someone help me?? Thank you!