iOS Question Webview not loading in Release Build

Arf

Well-Known Member
Licensed User
Longtime User
Hi,
I load a html file into a webview, works fine in debug but nothing seems to load in release mode.
It gets loaded like this (below), and info.htm is in my files.
B4X:
WebView1.LoadUrl("file://" & File.Combine(File.DirAssets, "info.htm"))

any ideas what I could try?
 

Arf

Well-Known Member
Licensed User
Longtime User
OK tried that, now I get a line of text in the webview windows saying:
file:///var/mobile/Containers/Bundle/Application/292911EB_a_bunch_of_numbers_/Test App.app/info.htm
 
Upvote 0

Arf

Well-Known Member
Licensed User
Longtime User
Ah it says 'Error reading file. Incorrect encoding'.

Can anyone recommend a nice simple wysiwyg html editor? I think I shouldn't be using word.
 
Upvote 0

Arf

Well-Known Member
Licensed User
Longtime User
I used another program to create a small html file to testing, still not loading. The Log output seems to read the text Ok but shows an exception of some kind:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/st
rict.dtd">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-ty
pe"><title>info</title></head>
<body><h1 style="color: rgb(0, 0, 248);">Information</h1><h2 style="color: rgb(0
, 102, 0);">About this file</h2><p>This
is a placeholder file, to see if the HTML is formatted correctly and
can be displayed in a WebView. We'll make this text quite long to be
sure that it wraps around the page. We'll make the document title blue,
and the headings green, and we'll add in a picture that should be
fitted to the width of the page and maintain a correct aspect ratio. The
font used should be Calc2. The picture is below this line.<img src="panorama.jpg
" alt="scenic" v:shapes="Picture_x0020_1" width="100%"></p><p></p></body></html>


*** WebKit discarded an uncaught exception in the webView:decidePolicyForNavigat
ionAction:request:frame:decisionListener: delegate: <NSInvalidArgumentException>
*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil objec
t from objects[0]

If I use LoadHtml instead of LoadUrl I don't get the exception, but nothing is displayed still.
I've just tried something else (see 'third attempt' below), and now it loads up properly.
Is it OK to proceed with the 3rd attempt code, or do you think there is still a problem lurking?

B4X:
WebView1.LoadUrl("file://" & File.Combine(File.DirAssets, "info.html"))  'first attempt
WebView1.LoadHtml("file://" & File.Combine(File.DirAssets, "info.html")) 'second attempt
WebView1.LoadHtml(File.ReadString(File.DirAssets, "info.html")) 'third attempt
 
Upvote 0
Top