gstory0404 / file_preview

A plug-in that supports flutter preview files,Flutter文档预览

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

抓到 iOS 的一个 bug

hellohejinyu opened this issue · comments

[log] @@@@: networkUrl: https://cos.ap-shanghai.myqcloud.com/868b-shanghai-090-sharedv4-01-1303031839/b1bb-1400703153/c7cf-IM_25990/f761a0a0bc2d314bd80d436dccc5fa9e-440118.pdf
[log] @@@@: localUrl: /private/var/mobile/Containers/Data/Application/90FDC56E-6C96-4AEF-8C4D-F06ADB3C3737/tmp/1400703153-IM_25990-8J5hBFH4ziqdTHL7OHda6PW25L65JRV8.pdf
[GETX] GOING TO ROUTE /FilePreviewPage
/private/var/mobile/Containers/Data/Application/90FDC56E-6C96-4AEF-8C4D-F06ADB3C3737/tmp/1400703153-IM_25990-8J5hBFH4ziqdTHL7OHda6PW25L65JRV8.pdf
file开始加载
file加载完成
[lifecycle] [u 20B3934E-3832-4706-ABA9-D27E2D769282:m (null)] [com.apple.PDFKit.PDFExtensionView(1.0)] Connection to plugin interrupted while in use.
[Loading] 0x110014818 - [pageProxyID=274, webPageID=275, PID=15305] WebPageProxy::dispatchProcessDidTerminate: reason=Crash
[lifecycle] [u 20B3934E-3832-4706-ABA9-D27E2D769282:m (null)] [com.apple.PDFKit.PDFExtensionView(1.0)] Connection to plugin invalidated while in use.
[Loading] 0x110014818 - [pageProxyID=274, webPageID=275, PID=15305] WebPageProxy::dispatchProcessDidTerminate: reason=Crash
[Process] 0x110014818 - [pageProxyID=274, webPageID=275, PID=15305] WebPageProxy::tryReloadAfterProcessTermination: process crashed and the client did not handle it, not reloading the page because we reached the maximum number of attempts
viewServiceDidTerminateWithError:: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
viewServiceDidTerminateWithError:: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
viewServiceDidTerminateWithError:: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
viewServiceDidTerminateWithError:: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
[Loading] 0x110014818 - [pageProxyID=274, webPageID=275, PID=15305] WebPageProxy::dispatchProcessDidTerminate: reason=Crash
[Loading] 0x110014818 - [pageProxyID=274, webPageID=275, PID=15305] WebPageProxy::dispatchProcessDidTerminate: reason=Crash
[Process] 0x110014818 - [pageProxyID=274, webPageID=275, PID=15305] WebPageProxy::tryReloadAfterProcessTermination: process crashed and the client did not handle it, not reloading the page because we reached the maximum number of attempts
[Loading] 0x110014818 - [pageProxyID=274, webPageID=275, PID=15305] WebPageProxy::dispatchProcessDidTerminate: reason=Crash
[Loading] 0x110014818 - [pageProxyID=274, webPageID=275, PID=15305] WebPageProxy::dispatchProcessDidTerminate: reason=Crash
[Process] 0x110014818 - [pageProxyID=274, webPageID=275, PID=15305] WebPageProxy::tryReloadAfterProcessTermination: process crashed and the client did not handle it, not reloading the page because we reached the maximum number of attempts
[Loading] 0x110014818 - [pageProxyID=274, webPageID=275, PID=15305] WebPageProxy::dispatchProcessDidTerminate: reason=Crash
[Loading] 0x110014818 - [pageProxyID=274, webPageID=275, PID=15305] WebPageProxy::dispatchProcessDidTerminate: reason=Crash
[Process] 0x110014818 - [pageProxyID=274, webPageID=275, PID=15305] WebPageProxy::tryReloadAfterProcessTermination: process crashed and the client did not handle it, not reloading the page because we reached the maximum number of attempts
[Loading] 0x110014818 - [pageProxyID=274, webPageID=275, PID=15305] WebPageProxy::dispatchProcessDidTerminate: reason=Crash
[Loading] 0x110014818 - [pageProxyID=274, webPageID=275, PID=15305] WebPageProxy::dispatchProcessDidTerminate: reason=Crash
[Process] 0x110014818 - [pageProxyID=274, webPageID=275, PID=15305] WebPageProxy::tryReloadAfterProcessTermination: process crashed and the client did not handle it, not reloading the page because we reached the maximum number of attempts
[Loading] 0x110014818 - [pageProxyID=274, webPageID=275, PID=15305] WebPageProxy::dispatchProcessDidTerminate: reason=Crash
[Loading] 0x110014818 - [pageProxyID=274, webPageID=275, PID=15305] WebPageProxy::dispatchProcessDidTerminate: reason=Crash
[Process] 0x110014818 - [pageProxyID=274, webPageID=275, PID=15305] WebPageProxy::tryReloadAfterProcessTermination: process crashed and the client did not handle it, not reloading the page because we reached the maximum number of attempts
[Loading] 0x110014818 - [pageProxyID=274, webPageID=275, PID=15305] WebPageProxy::dispatchProcessDidTerminate: reason=Crash
viewServiceDidTerminateWithError:: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
viewServiceDidTerminateWithError:: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
viewServiceDidTerminateWithError:: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
viewServiceDidTerminateWithError:: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
viewServiceDidTerminateWithError:: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
viewServiceDidTerminateWithError:: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
viewServiceDidTerminateWithError:: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
viewServiceDidTerminateWithError:: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
viewServiceDidTerminateWithError:: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
viewServiceDidTerminateWithError:: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
viewServiceDidTerminateWithError:: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
viewServiceDidTerminateWithError:: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
viewServiceDidTerminateWithError:: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
[Loading] 0x110014818 - [pageProxyID=274, webPageID=275, PID=15305] WebPageProxy::dispatchProcessDidTerminate: reason=Crash
[Process] 0x110014818 - [pageProxyID=274, webPageID=275, PID=15305] WebPageProxy::tryReloadAfterProcessTermination: process crashed and the client did not handle it, not reloading the page because we reached the maximum number of attempts
[Loading] 0x110014818 - [pageProxyID=274, webPageID=275, PID=15305] WebPageProxy::dispatchProcessDidTerminate: reason=Crash
[Loading] 0x110014818 - [pageProxyID=274, webPageID=275, PID=15305] WebPageProxy::dispatchProcessDidTerminate: reason=Crash
[Process] 0x110014818 - [pageProxyID=274, webPageID=275, PID=15305] WebPageProxy::tryReloadAfterProcessTermination: process crashed and the client did not handle it, not reloading the page because we reached the maximum number of attempts
[Loading] 0x110014818 - [pageProxyID=274, webPageID=275, PID=15305] WebPageProxy::dispatchProcessDidTerminate: reason=Crash
[Process] 0x110014818 - [pageProxyID=274, webPageID=275, PID=15305] WebPageProxy::didFailProvisionalLoadForFrame: frameID=3, isMainFrame=1, domain=WebKitErrorDomain, code=102, isMainFrame=1
[NSExtension] __plugin endUsing for '784A4DA7-4D45-48E5-B9B3-0BB551D34920' returned error: [u 20B3934E-3832-4706-ABA9-D27E2D769282:m (null)] [com.apple.PDFKit.PDFExtensionView(1.0)] endUsingRequest: called with unknown/expired request [ED553A9F-9494-4881-BC35-3702FE7BB16F]
Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service
Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service
Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service

日志如上,此时页面是白屏的。但是我没有找到规律。要是插件这边可以捕获错误就好了,这样前台我可以在错误的回调里面加个提示提示用户重试一下。

commented

可以看看 是不是TBS 没有加载成功

commented

/private/var/mobile/Containers/Data/Application/90FDC56E-6C96-4AEF-8C4D-F06ADB3C3737/tmp/1400703153-IM_25990-8J5hBFH4ziqdTHL7OHda6PW25L65JRV8.pdf
这个文件查看下 是否存在 @hellohejinyu

可以看看 是不是TBS 没有加载成功

iOS 用的不是webview么,只有安卓使用了TBS

可以看看 是不是TBS 没有加载成功

iOS 用的不是webview么,只有安卓使用了TBS

其实最简单的办法就是 让后台 导入Apache POI 库 然后返回html/pdf 等格式

if (ext == "pdf") {
if let data = try? Data(contentsOf: url! as URL) {
self.webView.load(data, mimeType: "application/pdf", characterEncodingName: "UTF-8", baseURL: url! as URL)
}
} else {
let request = NSMutableURLRequest(url: url! as URL)
self.webView.load(request as URLRequest as URLRequest)
}

这个问题我已经找到原因了,iOS webview 在加载网络 pdf 文件时,如果响应头里面的 Content-Type 不是 application/pdf,会加载失败。所以需要额外处理一下。