I have a hybrid web-app that uses Objective C and Javascript.
The javascript code triggers a call to wkwebkit on iOS which extracts a zip file entry (image) using the package ZipZap.
The image data in the zip file is represented as a blob, and then renderred on the screen.
The code to extract a zip file entry into a blob (binary -> base64 ascii -> binary -> blob) uses the following steps:
The reason that I'm using the base64 conversion, is to create a string that could be sent from Objective C to the javascript.
The code runs in a loop on the list of zip entries.
It runs ok on the entries in the list but at some point I get an error message from atob(): "invalid character for base64".
At this state, the value of the encoded base64 ASCII string shows "(null)".
From this point all the zip file entries return the same error and the encoded base64 ASCII string shows "(null)".
Then, the only way to recover is to reload the program which reinitiallizes WKWebView.
When I run a pure version of the web-app on an iOS device (i.g. not hybrid, via the browser, e.g. safari) the program also fails after a while with similar error (the blob buffer shows "null"), so I don't think this is a problem on iOS Objective C code side.
For reference, the program runs ok on other OSs, e.g. hybrid app on Android, pure web-app on Android/Linux/Windows/Mac in the browser.
From this, I suspect that WebView on iOS gets into bad state.
Ideally I want to solve the problem so that it does not occur in the first place.
So far I have not found how to do that so I'm looking for a way to recover without having to reload the program.
Is there a way to reset WKWebView without having to reload the program?
Thanks