简体   繁体   English

VFR-Reader在iOS8中崩溃

[英]VFR-Reader Crashing in iOS8

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. 我测试了一个目前在iOS8上使用VFR-Reader-Core的应用程序,当我尝试从中打开PDF时,我遇到了完全崩溃。 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 谢谢

In iOS 8, Te file system layout of app containers has changed. 在iOS 8中,应用程序容器的Te文件系统布局已更改。 Applications and their content are no longer stored in one root directory. 应用程序及其内容不再存储在一个根目录中。

From the iOS 8 Release Notes: 来自iOS 8发行说明:

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. 而不是依赖于硬编码的目录结构,使用NSSearchPathForDirectoriesInDomains函数或URLForDirectory:inDomain:appropriateForURL:create:error: NSFileManager类的方法。 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. 我已经简要介绍了这个问题,我可以看到VFRReader没有遵循Apple的上述建议。

I was going to rase an issue on the Github page however issue tracking seems to have been disabled. 我打算在Github页面上解决一个问题,但问题跟踪似乎已被禁用。 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 编辑:查看我的fork以获取适用于iOS8的版本: https//github.com/liamnichols/Reader
I've also submitted a pull request on the original repo: https://github.com/vfr/Reader/pull/54 我还在原始仓库上提交了拉取请求: https//github.com/vfr/Reader/pull/54

From the ReaderDocument.m of vfreader, the author stated that 作者从vfreader的ReaderDocument.m中说过

"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." “同样,//从iOS 8开始,应用程序的〜/ Documents目录不再存在于其捆绑包中,任何捆绑的PDF文件必须先复制到应用程序的//〜/ Documents目录中,然后才能访问它们。 “

Hope it helps. 希望能帮助到你。

Finally stumped on this: 终于难倒了:

@synchronized(nil)  {
    CGContextDrawPDFPage(context, _PDFPageRef);
}

and it's works now in iOS8. 它现在在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 内存泄漏,有时是好方法,有时是错误的方式:D

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM