iOS Question WKWebView in IOS13 stopped working

db0070

Active Member
Licensed User
My app has stopped working since ios 13.3 upgrade. It is now failing to display the page in Webview. This is my code :-

B4X:
    Dim xui As XUI
    File.Copy(File.DirAssets, la(Index,0) & ".pdf", File.DirDocuments, "page.pdf")
    WKWebView1.LoadUrl(xui.FileUri(File.DirDocuments, "page.pdf"))
There are no error messages when I run in debug mode. Nothing happens when the code is run. Contacted Apple, and their reply: -

"if it is only failing to work on the latest OS. Then it may need to be updated to correct any incompatibles with the Latest iOS versions"

I have checked, the app works on older IOS versions.
 

mrossen

Active Member
Licensed User
Hi,

I am doing this. It works in iOS 13.3

B4X:
Dim filename as string = "page.pdf"

If File.Exists(File.DirAssets, filename) Then
    WKWebViewHelp.LoadHtml(File.ReadString(File.DirAssets, filename))
end if
Mogens
 
Last edited:

db0070

Active Member
Licensed User
I changed my code to
B4X:
    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))
 

db0070

Active Member
Licensed User
Ah, wait, my file is not image, it is pdf!
That is why I was using WKWebView1.LoadUrl

So the problem is still there - I cannot display pdf files in iOS 13.3
 

db0070

Active Member
Licensed User
That is what I am doing, and it’s stopped working in ios13.3:-

B4X:
    Dim xui As XUI
    File.Copy(File.DirAssets, la(Index,0) & ".pdf", File.DirDocuments, "page.pdf")
    WKWebView1.LoadUrl(xui.FileUri(File.DirDocuments, "page.pdf"))
 

db0070

Active Member
Licensed User
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:

https://apps.apple.com/gb/app/tahsinul-quran/id1454041122

I running xCustomListView Version 1.73
and iXUI version 1.9
 
Last edited:

db0070

Active Member
Licensed User
Yes, that works. I will do further debugging. In my project the WKWebView is added to a customlistivew - maybe that is the problem
 

db0070

Active Member
Licensed User
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?
 
Top