WKWebView CALayerInvalidGeometry
问题
WKWebView
加载 本地PDF
CoreFoundation ___exceptionPreprocess + 124
1 libobjc.A.dylib objc_exception_throw + 56
2 CoreFoundation -[NSException initWithCoder:]
3 QuartzCore 0x000000018cd9f000 + 1108684
4 QuartzCore 0x000000018cd9f000 + 1109064
5 QuartzCore 0x000000018cd9f000 + 1110424
6 UIKit -[UIView(Geometry) setFrame:] + 792
7 WebKit -[WKPDFView _computePageAndDocumentFrames] + 648
8 WebKit -[WKPDFView _didLoadPDFDocument] + 104
9 WebKit -[WKPDFView web_setContentProviderData:suggestedFilename:] + 164
10 WebKit -[WKWebView _didFinishLoadingDataForCustomContentProviderWithSuggestedFilename:data:] + 84
11 WebKit WebKit::PageClientImpl::didFinishLoadingDataForCustomContentProvider(WTF::String const&, IPC::DataReference const&) + 100
-
In my case it was triggered by trying to display a UIWebView that had been created from an NSData object with invalid data, possibly from an empty file
-
测试: 加载本地
0KB
的PDF
文件并不会导致CALayerInvalidGeometry
解决
-
WKWebView
或者UIWebview
初始化 一定要设置frame
-
设置Xcode
CG_NUMERICS_SHOW_BACKTRACE
环境变量 检测异常参数 -
键盘的问题??
参考
- IOS Simulator 5 webview error : CALayerInvalidGeometry
- WKWebView crashes if user answers an incoming iMessage
- Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer bounds contains NaN: [0 nan; 280 524]
- 利用WebView加载文件的几种方式
- WKWebView- Custom Types for Powerful Matching
- WKWebView