iOS Question webview load html error

kisoft

Well-Known Member
Licensed User
HI
I want to load html file from local folder, I use this code:
B4X:
Dim a2 As String="myfile.html"
    WebView1.LoadHtml(File.ReadString(File.DirAssets,a2))
Or
B4X:
dim xui as xui
WebView1.LoadUrl(xui.FileUri(File.DirAssets,a2))
in both cases I get the same error.
B4X:
Application_Start
Application_Active
main indeks=4
2
index otrzymany2
3
litanie indeks=3
myfile.html
Error occurred on line: 38 (widok)
Object was not initialized (UIWebView)
Stack Trace: (
  CoreFoundation       <redacted> + 256
  libobjc.A.dylib      objc_exception_throw + 60
  CoreFoundation       <redacted> + 0
  Modapk               -[B4IObjectWrapper object] + 152
  Modapk               -[B4IWebViewWrapper LoadHtml:] + 68
  CoreFoundation       <redacted> + 148
  CoreFoundation       <redacted> + 324
  Modapk               +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1624
  Modapk               -[B4IShell runVoidMethod] + 232
  Modapk               -[B4IShell raiseEventImpl:method:args::] + 1800
 Modapk               -[B4IShellBI raiseEvent:event:params:] + 1580
 Modapk               +[B4IDebug delegate:::] + 80
 Modapk               -[b4i_widok _wyswtekst] + 240
 CoreFoundation       <redacted> + 148
 CoreFoundation       <redacted> + 324
 Modapk               +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1624
I'm sorry. Problem solved. Probably a flawed html file.
The right code is this one:

B4X:
Dim a2 As String="myfile.html"
    WebView1.LoadHtml(File.ReadString(File.DirAssets,a2))
 
Last edited:
Top