Dim filename as string = "page.pdf"
If File.Exists(File.DirAssets, filename) Then
WKWebViewHelp.LoadHtml(File.ReadString(File.DirAssets, filename))
end if
Dim fileName As String = la(Index,0) & ".pdf"
If File.Exists(File.DirAssets, fileName) Then
WKWebView1.LoadHtml(File.ReadString(File.DirAssets, fileName))
End If
and I am now getting a 'Error reading file. Incorrect encoding' on this line WKWebView1.LoadHtml(File.ReadString(File.DirAssets, fileName))
Check the inline documentation. WKWebView.LoadURL will not work with File.DirAssets. You need to copy the file to File.DirDocuments and load it from there.
Just tested it with a device running iOS 13.3 and it works fine:
B4X:
File.Copy(File.DirAssets, "1.pdf", File.DirDocuments, "1.pdf")
WKWebView1.LoadUrl(xui.FileUri(File.DirDocuments, "1.pdf"))
Sub WKWebView1_PageFinished (Success As Boolean, Url As String)
Log(Success)
Log(Url)
End Sub
When I run it on my iPhone 6S, the Log(Success) is false and Log(Url) is empty string.
Other people have reported that since the iOS 13.3 upgrade the app has stopped working.
This is the app - which was updated two months ago, and was working until the update of iOS a few days ago:
I found the problem but I can't understand why.
In Page_Resize I had this line
B4X:
CustomListView1_ItemClick(currentLesson,"")
CustomListView item click basically has this code: -
B4X:
Dim xui As XUI
File.Copy(File.DirAssets, la(Index,0) & ".pdf", File.DirDocuments, fileName)
If File.Exists(File.dirdocuments, fileName) Then
WKWebView1.LoadUrl(xui.FileUri(File.DirDocuments, fileName))
End If
By disabling that call to CustomListView_ItemClick in Page_Resize, the problem is solved. But why in IOS13.3 only?