iOSHTMLViewer Loading HTML From Documents Folder

I’m having problems loading a HTML file located in documents folder of the iOS app.
I works fine in the debugger.
It works fine on iPad Pro (iOS 12 & iOS 13).
It doesn’t work on iPhone SE, iOS 12, but I don’t find any errors, the html page is just empty.

Html file is loaded with LoadURL(htmlFile.URLPath)

Xojo 2019r2, macOS Mojave.

As found in the docs: Loading HTML From Documents Folder
I tried this method:

[code]Declare Function NSClassFromString Lib “Foundation.framework” (clsName As CFStringRef) As ptr
Declare Function URLWithString Lib “Foundation.framework” Selector “URLWithString:” ( id As Ptr, URLString As CFStringRef ) As Ptr

Declare Sub loadFileURL Lib “UIKit.framework” Selector “loadFileURL:allowingReadAccessToURL:” (obj As Ptr, url As Ptr, readAccessURL As Ptr)

// htmlFile is a Xojo.IO.FolderItem from Xojo.IO.SpecialFolder.Documents
Var nsURL As Ptr = URLWithString(NSClassFromString(“NSURL”), htmlFile.URLPath)
Var readURL As Ptr = URLWithString(NSClassFromString(“NSURL”), htmlFile.parent.URLPath)

loadFileURL(htmlPresentation.Handle, nsURL, readURL)[/code]

Doesn’t compile because « item doesn’t exist » for htmlPresentation.Handle.

Any idea about htmlPresentation ?? What should it be ?

Thanks !

That should the name of the iOSHTMLViewer you are using, respectively “me” or “self” depending on the location of your code.

Yes !
Thanks Ulrich.

Simple but poorly documented :wink:

That code was probably pasted from a project and the name not changed to the more descriptive ClassName+Number naming scheme like the other examples.
You could click on “Send doc feedback” on the bottom to send a note to Paul.

Mail sent.