问题
I tested an app that is currently working with the VFR-Reader-Core on iOS8 and I get a complete crash when I try to open a PDF from it. Am I the only one with this problem? any idea of where I can search to correct this? Here is the crash report
Thank you
回答1:
In iOS 8, Te file system layout of app containers has changed. Applications and their content are no longer stored in one root directory.
From the iOS 8 Release Notes:
The file system layout of app containers has changed on disk. Rather than relying on hard-coded directory structure, use the NSSearchPathForDirectoriesInDomains function or the URLForDirectory:inDomain:appropriateForURL:create:error: method of the NSFileManager class. See Accessing Files and Directories in File System Programming Guide.
I've had a brief look into the issue and i can see that VFRReader does not follow the above recommendations from Apple.
I was going to rase an issue on the Github page however issue tracking seems to have been disabled. If i get some extra time today, I will look into resolving this and raising a pull request.
Edit: Check out my fork for a version that works on iOS8: https://github.com/liamnichols/Reader
I've also submitted a pull request on the original repo: https://github.com/vfr/Reader/pull/54
回答2:
From the ReaderDocument.m of vfreader, the author stated that
"As well, // since as of iOS 8, the application's ~/Documents directory no longer lives in // its bundle, any bundled PDF files must be copied into the the application's // ~/Documents directory before they can be accessed."
Hope it helps.
回答3:
Finally stumped on this:
@synchronized(nil) {
CGContextDrawPDFPage(context, _PDFPageRef);
}
and it's works now in iOS8.
EDIT: did some changes in the code and now even this does not help me avoid this crash. But now if I run on device then it works. (crash on simulator).
Memory leaks, sometimes the good way, sometimes the wrong way :D
来源:https://stackoverflow.com/questions/25372149/vfr-reader-crashing-in-ios8