3

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

3 Answers3

8

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

liamnichols
  • 12,419
  • 2
  • 43
  • 62
  • Hi @liamnichols thanks for this fix. But, every time I open a pdf file it crashes on CGContextDrawPDFPage(context, thePDFPageRef); I have tried different pdf files. Any clue? – Ali Sufyan Sep 23 '14 at 14:14
  • Sorry, I don't know much about Core Graphics and PDF rendering, this is why i rely on third party libraries :) Good luck fixing it though.. Seen some other people ask about that crash on my pull request as well... Maybe they fixed it? – liamnichols Sep 23 '14 at 15:21
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.

GreenAsJade
  • 14,459
  • 11
  • 63
  • 98
1

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

Yaro
  • 1,222
  • 11
  • 15