Crash with PDFKit on iOS 12.2

2019-07-11 17:34发布

问题:

In iOS 12.2, passing true to PDFView's usePageViewController(_, withViewOptions:) will cause a crash with the following exception:

*** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan nan]'

The same code works fine on iOS 12.1. I also have other projects that do this and those projects do work on iOS 12.2, but their view controller hierarchy is quite a bit more complicated.

Is there possibly something I'm missing, or should I file a bug report with Apple?

I have created a tiny project on github which demonstrates the crash at https://github.com/rudedogdhc/crash-pdfview-ios12.2

回答1:

Try moving usePageViewController(_, withViewOptions:) (and everything else you're setting up with it for that matter) into viewDidAppear instead of viewDidLoad

I ran into the same problem and found the answer here: There's problem with PDFKit appeared after update to Xcode 10.2. Is there any way to solve?



标签: ios pdfview