WKWebView in a modal window

Is there any particular reason why a WKWebView instance set as the contentView of a NSWindow would not display web content when the window is displayed using the runModalForWindow method of NSApplication?

If I display the window using the showWindow method of NSWindowController, it displays correctly.

If I replace the WKWebView instance with a WebView instance, the web content displays correctly whether the window is shown modally or not.

In all cases I am calling loadRequest: in windowDidLoad.

Bruce

Just ran into the same problem as you. It seems that WKWebView needs a certain NSRunLoop to do its work on, or perhaps it schedules its loading task on a queue that is paused while a modal window is running. Did you ever figure it out?

Four years later and I too encountered this problem after moving from WebView to WKWebView. Usually it worked, but sometimes it didn't.

In my case, when it didn't work, the problematic modal window run loop was being invoked (ultimately) from inside a dispatch_async block. Rearranging things to avoid doing that solved the problem for me.

WKWebView in a modal window
 
 
Q