swifter icon indicating copy to clipboard operation
swifter copied to clipboard

WKWebView freezes when I start the Swifter http server

Open josh83abc opened this issue 6 years ago • 2 comments

Hi guys!

I'm an experienced developer but a beginner with Swift and iOS, so your help will be very valuable. My iOS app is based on a WKWebView loading some HTML (hybrid app).

Since the WKWebView cant access to local files, I wanted to run a HTTP server on the iOS device and then use it from inside the WKWebView.

However, when I start the Swifter server like in your example, my WKWebView becomes unresponsive and completely frozen.

How can I fix that? Maybe I missed something :)

Thanks a lot!! Josh

josh83abc avatar Mar 01 '19 05:03 josh83abc

Hey, @josh83abc 👋. It would be very helpful if you could create a sample project with your issue.

Vkt0r avatar Mar 12 '19 14:03 Vkt0r

Hi, I think you need to use dispatch to main thread, like this "DispatchQueue.main.async" so you won't block main thread and your app won't freeze. But as was said above, if you have some example help could be more efficient.

VitalKz avatar Mar 25 '19 15:03 VitalKz