WKWebView not displaying anything under Mac Catalyst

Starting with beta 4 of Mac OS 10.15, I am not seeing any contents displayed in a WKWebView. When runing in an iOS simulater, content is displayed as expected, but running as a desktop app under catalyst, nothing shows. To make sure this wasn't a problem with our existing project, I made a complately new project with nothing more than a single view controller containing a WKWebView and the same behavior was observed. When running as a desktop app and using the Web Inspector in Safari to attach to the web view, I can see that the html is in fact being loaded, just not displayed for some reason. This happens when using both loadHtmlString and loadRequest.

Replies

I see exactly the same behavior. On Xcode 11 beta 4 and Catalina beta 4, an iOS WKWebView that renders correctly running on the iOS 13 simulator renders blank when running on macOS Catalina built via Catlyst. This happens both when the original HTML content is in a file that is part of the app bundle or when the HTML is passed directly to the WKWebView as a string. On macOS when the content is in a file I have verified that the file is accessible and the contents can be loaded as a string. I also tried it with the simplest possible single view example and the behavior is the same.


I think that this is a problem with the macOS/Catalyst implementation of the iOS WKWebView. I filed Feedback on it.

We are facing this issue as well.

Even I could the see same with my existing project. Even If I try to copy that content , it is crashing somewhere in webcore.

I can confirm, nothing appears, though the page obviously loads correctly, because I can scroll.

Same probelm here, able to scroll but nothing appears.

It now appears to be fixed - working correctly when tested with Xcode 11 beta 5 and macOS Catalina beta 5.

I have checked it. Still it's not working in beta 5.

Not only webview...


Custom Metal rendering is not appearing on macOS with Catalyst while it appears just fine on iOS device.


And the frame debugger is showing me its rendering just fine. Just totally blank on my macOS retina display


😟

Same issue as all reported here... WKWebView works fine in iOS Sim and device to display PDFs and websites. In Catalist Mac OS App only Web content is displayed. PDFs or other files are just a blank canvas loaded. Code and breakpoints show no errors.


Running in Release version of both Mac OS Catalyna and Xcode 11.


Mac OS Catalina Version 10.15

Xcode 11 Version 11.1

After having the same experience I used PDFView instead of WKWebView and it worked on macOS using Catalyst.

Can anyone confirm (or deny) that this is working with Xcode 11.2.1 and macOS 10.15.1 (both are released versions). I am getting a blank WKWebView when exeuting:


webView.loadHTMLString(html, baseURL: Bundle.main.bundleURL)


Working fine on iOS but not macOS. I was hoping to release a macOS version in a month or so but this is a show stopper.

I figured out my issue. Apparently Catalyst handle the baseURL differently than on iOS. I had the following code:


webView.loadHTMLString(html, baseURL: Bundle.main.bundleURL)


on Catalyst you apparently need to do:


webView.loadHTMLString(html, baseURL: Bundle.main.bundleURL.appendingPathComponent("Contents/Resources/Info/"))


The web view was not finding my CSS files that were part of the bundle. Without the CSS I was getting black text on a black background which was why I wasn't seeing anything. The CSS specifies white text.