Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

138
Visualizações
How to reset WKWebView when it gets into a bad state without reloading the program

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 entry is extracted as Objective C NSData type, and then encoded via base64, from binary into ASCII string.
  • The encoded base64 ASCII string is then decoded into a decoded binary string using the function atob().
  • The decoded binary string is then represented as Uint8Array in a byteArray.
  • Finally the Uint8Array byteArray creates a new Blob.

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

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda