Open urshofer opened 1 year ago
Try uninstalling this plugin, and see if the error keeps happening.
Without plugin the error does not happen. It seems like while the scanner is active, the webview in the background is restarted due to a crash. Saving the scan is not possible since the new webview has no connection to the callback from the scanner.
Any updates here? Having the same issues here with the logs below:
2023-02-21 11:03:58.215457-0600 App[2090:277065] [XPC] Handle connection with error: Connection interrupted
2023-02-21 11:03:58.368162-0600 App[2090:272383] [Process] 0x111000b90 - [PID=2223] WebProcessProxy::didClose: (web process 0 crash)
2023-02-21 11:03:58.368530-0600 App[2090:272383] [Process] 0x111000b90 - [PID=2223] WebProcessProxy::processDidTerminateOrFailedToLaunch: reason=Crash
2023-02-21 11:03:58.369847-0600 App[2090:272383] [ProcessSuspension] 0x1100201e0 - ProcessAssertion: Failed to acquire RBS Background assertion 'ConnectionTerminationWatchdog' for process because PID 0 is invalid
2023-02-21 11:03:58.370038-0600 App[2090:277065] [ProcessSuspension] 0x1100201e0 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'ConnectionTerminationWatchdog' for process with PID=0, error: (null)
2023-02-21 11:03:58.373799-0600 App[2090:272383] [Process] 0x102010018 - [pageProxyID=8, webPageID=9, PID=2223] WebPageProxy::processDidTerminate: (pid 2223), reason=Crash
No - no solution found so far. I tried to install the newest dependencies, but the Webview just crashes sometimes in the background and does a clean restart. So it looks like the app is still running but the PID changed and there's no possibility for the plugin to pass the data back to the app. It happens on all iOS Devices I have, iPhone SE 2022 and two different iPads with latest iOS installed. The crash happens not regularly, sometimes i feel it happens less often if there are no other apps running. Maybe there's a possibility for a (nasty?) workaround. Someting like: Passing a filename to the plugin, store this name persistently, and check on every startup for a filename entry in the persistent store. In case of a crash the webview could watch for this filename and restore the scan even after a crash.
Just waking up an old thread: After upgrades (capacitor, iOS) the bug still exists. I'm not even sure if it's a problem of capacitor-document-scanner or capacitor/ionic itself, or even a webkit bug. Anyway, If somebody knows more or has a workaround, glad to know :)
Since I'm stuck here, I cross posted the issue in the ionic forum as well.
Anybody can fix this issue? 😢
No - I've switched my codebase to flutter, but even there using the iOS built in document scanner is wonky. Sometimes it just crashes without further notice due to memory pressure. My setup now is using not the native scanner, but the one from Wetransfer (https://github.com/WeTransfer/WeScan), which looks more stable.
@urshofer Hey I was wondering if by chance you made a capacitor plugin for WeScan ? I don't really know much of Swift so it would help a lot
I've come upon the same issue. It's not much help solution-wise, but it does appear to be that the crash is caused by occasional spikes in the memory while the camera scanner is active. See the attached image, with the spike where a crash occurred circled in red.
Here's someone else also describing the same issue and diagnosing it as being caused by a memory spike: https://github.com/ionic-team/capacitor/issues/6549#issuecomment-1529816229
Since this is an issue with the plugin from Apple, there may not be much to do. In any case, from the lack of customization options, it seems as if Apple hasn't put much effort into making VNDocumentCameraViewController usable by third-party applications.
@urshofer @dmarcs
Hi -
Thanks for your great Work.
In my case, when opening the scanner, the App in the background sometimes crashes and restarts. Therefore not listening to any callbacks and the scanned input is lost. I don't know when exactly it happens. Not depending of the size of the scan.
It might be related to a webkit bug: https://github.com/ionic-team/capacitor/issues/5491
Anyway, here's the log:
Maybe somebody can point me in the right direction for a fix.
Best, hofer